aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-04-04 04:16:48 +0000
committerAndrew Cagney <cagney@redhat.com>2000-04-04 04:16:48 +0000
commiteb90a51f9d4756c52f40cf2f4b906e1f6abc646b (patch)
tree9db43f4c91e7265a885c2db7d9307a83183e7d46 /gdb/printcmd.c
parentd66c34e293ba1b0b0129729c3f8a2c46ad1567c8 (diff)
downloadgdb-eb90a51f9d4756c52f40cf2f4b906e1f6abc646b.zip
gdb-eb90a51f9d4756c52f40cf2f4b906e1f6abc646b.tar.gz
gdb-eb90a51f9d4756c52f40cf2f4b906e1f6abc646b.tar.bz2
Stop GCC thinking a shift will overflow.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 07139dd..5068cc9 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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;