]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify gcc -Woverflow more clearly
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 14 Jul 2021 22:10:06 +0000 (17:10 -0500)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 14 Jul 2021 22:20:19 +0000 (17:20 -0500)
* src/alloc.c (mark_maybe_pointer): Make it clearer that ANDing
with UINTPTR_MAX is intended.  Omit a now-unnecessary cast.

src/alloc.c

index ee3fd64a0034c24851d9d7ad09a783e6cc6294bc..8edcd06c8435a988a5aed862553b874522fcc820 100644 (file)
@@ -4764,7 +4764,9 @@ mark_maybe_pointer (void *p, bool symbol_only)
         from Emacs source code, it can occur in some cases.  To fix
         this problem, the pdumper code should grok non-initial
         addresses, as the non-pdumper code does.  */
-      void *po = (void *) ((uintptr_t) p & (uintptr_t) VALMASK);
+      uintptr_t mask = VALMASK & UINTPTR_MAX;
+      uintptr_t masked_p = (uintptr_t) p & mask;
+      void *po = (void *) masked_p;
       char *cp = p;
       char *cpo = po;
       /* Don't use pdumper_object_p_precise here! It doesn't check the