From 1e2d919ef0c1845dbe2f12dbbcff9e05055e2ea3 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 15 Dec 2017 00:54:04 +0300 Subject: [PATCH] Eliminate UBSan warning of overflow during descr subtraction in mark_from There is no unsigned overflow because descr has a negative value actually when it is subtracted from type_descr. * mark.c (GC_mark_from): Cast descr to signed_word in (type_descr-(descr+...)). --- mark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mark.c b/mark.c index 1da4a142..705c4a41 100644 --- a/mark.c +++ b/mark.c @@ -803,8 +803,8 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack, continue; } descr = *(word *)(type_descr - - (descr + (GC_INDIR_PER_OBJ_BIAS - - GC_DS_PER_OBJECT))); + - ((signed_word)descr + (GC_INDIR_PER_OBJ_BIAS + - GC_DS_PER_OBJECT))); } if (0 == descr) { /* Can happen either because we generated a 0 descriptor */ -- 2.40.0