summaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2022-02-14 10:41:07 +0000
committerKaz Kylheku <kaz@kylheku.com>2022-02-14 05:36:24 -0800
commit8da8ba5a1cc7adf3ad5a4576510aae5c31ae0a6e (patch)
tree67a7dce6de0290e115617dddc2cb81b32874ef4c /gc.c
parent9bf2278076ae65f63cf0aacb213c4608f9732bbb (diff)
downloadtxr-8da8ba5a1cc7adf3ad5a4576510aae5c31ae0a6e.tar.gz
txr-8da8ba5a1cc7adf3ad5a4576510aae5c31ae0a6e.tar.bz2
txr-8da8ba5a1cc7adf3ad5a4576510aae5c31ae0a6e.zip
Fix various instances of implicit conversions.
The implicit conversions were discovered with Clang's UBSan (with the -fsanitizer=implicit-conversion option). * gc.c (sweep_one): Convert only the inverted REACHABLE, since block->t.type is already of the right type. * hash.c (eql_hash, eq_hash, hash_iter_init, us_hash_iter_init): Explicitly convert to ucnum. * linenoise/linenoise.c (enable_raw_mode): Explicitly convert the inverted flag sets to tcflag_t. * mpi/mpi.c (mp_set_uintptr): Explicitly convert to uint_ptr_t. * regex.c (char_set_add): Explicitly convert to bitcell_t. * struct.c (struct_inst_hash): Correct type of hash from cnum to ucnum.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 0c727ed4..311f66d2 100644
--- a/gc.c
+++ b/gc.c
@@ -606,7 +606,7 @@ static int sweep_one(obj_t *block)
#if CONFIG_GEN_GC
block->t.gen = 1;
#endif
- block->t.type = convert(type_t, block->t.type & ~REACHABLE);
+ block->t.type &= convert(type_t, ~REACHABLE);
return 0;
}