]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Stop GCC thinking a shift will overflow.
authorAndrew Cagney <cagney@redhat.com>
Tue, 4 Apr 2000 04:16:48 +0000 (04:16 +0000)
committerAndrew Cagney <cagney@redhat.com>
Tue, 4 Apr 2000 04:16:48 +0000 (04:16 +0000)
gdb/ChangeLog
gdb/printcmd.c

index c30b5dd501a912274bfc32d6e3499874e55aec9a..98580a6c153d97342fda895421473aa69b9db908 100644 (file)
@@ -1,3 +1,8 @@
+Tue Apr  4 12:13:19 2000  Andrew Cagney  <cagney@b1.cygnus.com>
+
+       * printcmd.c (print_scalar_formatted): Use local variable ptr_bit
+       in shift.  Stop GCC thinking it has a shift overflow.
+
 2000-04-03  H.J. Lu  <hjl@gnu.org>
 
        * TODO: Remove the regex entry.
index 07139dd4ad9daa576331d0b0ecfa695310b7418c..5068cc96c48dd5df2d61ea30129b019d29aeaab7 100644 (file)
@@ -445,10 +445,13 @@ print_scalar_formatted (valaddr, type, format, size, stream)
     case 'a':
       {
        /* Truncate address to the size of a target pointer, avoiding
-          shifts larger or equal than the width of a CORE_ADDR.  */
+          shifts larger or equal than the width of a CORE_ADDR.  The
+          local variable PTR_BIT stops the compiler reporting a shift
+          overflow when it won't occure. */
        CORE_ADDR addr = unpack_pointer (type, valaddr);
-       if (TARGET_PTR_BIT < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-         addr &= ((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1;
+       int ptr_bit = TARGET_PTR_BIT;
+       if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+         addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
        print_address (addr, stream);
       }
       break;