[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 0afbde4: Pacify gcc -Woverflow more clearly

From: Paul Eggert
Subject: master 0afbde4: Pacify gcc -Woverflow more clearly
Date: Wed, 14 Jul 2021 18:20:25 -0400 (EDT)

branch: master
commit 0afbde4e68c1161a54f9593ecb5b66fe42aa0de4
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Pacify gcc -Woverflow more clearly
    * src/alloc.c (mark_maybe_pointer): Make it clearer that ANDing
    with UINTPTR_MAX is intended.  Omit a now-unnecessary cast.
 src/alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/alloc.c b/src/alloc.c
index ee3fd64..8edcd06 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]