]> granicus.if.org Git - gc/commitdiff
Workaround 'bad pointer arithmetic' false waring in check_annotated_obj
authorIvan Maidanski <ivmai@mail.ru>
Fri, 31 Aug 2018 17:00:33 +0000 (20:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 31 Aug 2018 17:00:33 +0000 (20:00 +0300)
* dbg_mlc.c [!SHORT_DBG_HDRS] (GC_check_annotated_obj): Change
(word*)ptr+ofs expressions to &((word*)ptr)[ofs].

dbg_mlc.c

index af9652af5e0dcf8c73a9303de182a98839e78019..4d547c150c4f36ea921c55d6f0af631499be3e35 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -334,11 +334,11 @@ static void *store_debug_info(void *p, size_t lb,
         return((ptr_t)(&(ohdr -> oh_sf)));
     }
     if (((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1] != (END_FLAG ^ (word)body)) {
-        return((ptr_t)((word *)ohdr + BYTES_TO_WORDS(gc_sz)-1));
+        return (ptr_t)(&((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1]);
     }
     if (((word *)body)[SIMPLE_ROUNDED_UP_WORDS(ohdr -> oh_sz)]
         != (END_FLAG ^ (word)body)) {
-        return((ptr_t)((word *)body + SIMPLE_ROUNDED_UP_WORDS(ohdr->oh_sz)));
+        return (ptr_t)(&((word *)body)[SIMPLE_ROUNDED_UP_WORDS(ohdr->oh_sz)]);
     }
     return(0);
   }