wip tests asan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/libkc3/buf_parse.c b/libkc3/buf_parse.c
index bb7a0eb..9b7755c 100644
--- a/libkc3/buf_parse.c
+++ b/libkc3/buf_parse.c
@@ -2265,8 +2265,7 @@ sw buf_parse_integer_unsigned_dec (s_buf *buf, s_integer *dest)
if ((r = buf_parse_digit_dec(buf, &digit)) <= 0)
goto clean;
result += r;
- integer_init_zero(dest);
- if (mp_add_d(&dest->mp_int, digit, &dest->mp_int) != MP_OKAY)
+ if (! integer_init_u8(dest, digit))
goto error;
while ((r = buf_read_1(buf, "_")) >= 0 &&
(result += r,
diff --git a/libkc3/env.c b/libkc3/env.c
index f637c00..b24b6bc 100644
--- a/libkc3/env.c
+++ b/libkc3/env.c
@@ -188,6 +188,7 @@ void env_clean (s_env *env)
void env_clean_globals (s_env *env)
{
frame_clean(&env->global_frame);
+ frame_clean(&env->read_time_frame);
}
void env_clean_toplevel (s_env *env)
diff --git a/libkc3/tag.c b/libkc3/tag.c
index 7f82832..8e34552 100644
--- a/libkc3/tag.c
+++ b/libkc3/tag.c
@@ -569,22 +569,54 @@ s_tag * tag_integer_reduce (s_tag *tag)
i = &tag->data.integer;
if (compare_integer(i, &u64_max) > 0)
return tag;
- if (compare_integer(i, &u32_max) > 0)
- return tag_init_u64(tag, integer_to_u64(i));
- if (compare_integer(i, &u16_max) > 0)
- return tag_init_u32(tag, integer_to_u32(i));
- if (compare_integer(i, &u8_max) > 0)
- return tag_init_u16(tag, integer_to_u16(i));
- if (compare_integer(i, &zero) >= 0)
- return tag_init_u8(tag, integer_to_u8(i));
- if (compare_integer(i, &s8_min) >= 0)
- return tag_init_s8(tag, integer_to_s8(i));
- if (compare_integer(i, &s16_min) >= 0)
- return tag_init_s16(tag, integer_to_s16(i));
- if (compare_integer(i, &s32_min) >= 0)
- return tag_init_s32(tag, integer_to_s32(i));
- if (compare_integer(i, &s64_min) >= 0)
- return tag_init_s64(tag, integer_to_s64(i));
+ if (compare_integer(i, &u32_max) > 0) {
+ j = tag->data.integer;
+ tag_init_u64(tag, integer_to_u64(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &u16_max) > 0) {
+ j = tag->data.integer;
+ tag_init_u32(tag, integer_to_u32(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &u8_max) > 0) {
+ j = tag->data.integer;
+ tag_init_u16(tag, integer_to_u16(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &zero) >= 0) {
+ j = tag->data.integer;
+ tag_init_u8(tag, integer_to_u8(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &s8_min) >= 0) {
+ j = tag->data.integer;
+ tag_init_s8(tag, integer_to_s8(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &s16_min) >= 0) {
+ j = tag->data.integer;
+ tag_init_s16(tag, integer_to_s16(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &s32_min) >= 0) {
+ j = tag->data.integer;
+ tag_init_s32(tag, integer_to_s32(&j));
+ integer_clean(&j);
+ return tag;
+ }
+ if (compare_integer(i, &s64_min) >= 0) {
+ j = tag->data.integer;
+ tag_init_s64(tag, integer_to_s64(&j));
+ integer_clean(&j);
+ return tag;
+ }
return tag;
case TAG_S8:
integer_init_s8(&j, tag->data.s8);
diff --git a/misc/Makefile b/misc/Makefile
index 359fe4e..a233ae0 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -30,7 +30,7 @@ http_response_offsets: http_response_offsets.c
${CC} ${CPPFLAGS} -I.. http_response_offsets.c -o http_response_offsets
print_limits: print_limits.c
- libtool --mode=link ${CC} ${CPPFLAGS} -I.. print_limits.c -L../libkc3 -lkc3 -o print_limits
+ libtool --mode=link --tag=CC ${CC} ${CPPFLAGS} -I.. print_limits.c -L../libkc3 -lkc3 -o print_limits
.PHONY: \
all \