From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFA: fix warning building spu-tdep.c
Date: Tue, 04 Aug 2009 14:51:00 -0000 [thread overview]
Message-ID: <m3tz0nhbte.fsf@fleche.redhat.com> (raw)
I got this error while building gdb cvs on x86 F11 yesterday:
../../src/gdb/spu-tdep.c: In function ‘spu_gdbarch_id’:
../../src/gdb/spu-tdep.c:362: error: overflow in implicit constant conversion
../../src/gdb/spu-tdep.c: In function ‘gdb_print_insn_spu’:
../../src/gdb/spu-tdep.c:1597: error: overflow in implicit constant conversion
../../src/gdb/spu-tdep.c: In function ‘spu_overlay_update_osect’:
../../src/gdb/spu-tdep.c:1739: error: large integer implicitly truncated to unsigned type
The problem is that CORE_ADDR is 4 bytes here, but LONGEST is 8.
The fix is to change SPUADDR_SPU to cast its result to CORE_ADDR. This
seems to be what is expected -- but, some places use int while others
use CORE_ADDR, so I did not want to commit this without review from
someone who knows the intent of this macro.
Tom
2009-08-04 Tom Tromey <tromey@redhat.com>
* spu-tdep.h (SPUADDR_SPU): Cast result to CORE_ADDR.
Index: spu-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/spu-tdep.h,v
retrieving revision 1.7
diff -u -r1.7 spu-tdep.h
--- spu-tdep.h 31 Jul 2009 15:28:27 -0000 1.7
+++ spu-tdep.h 4 Aug 2009 14:48:10 -0000
@@ -54,7 +54,9 @@
#define SPUADDR(spu, addr) \
((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr))
#define SPUADDR_SPU(addr) \
- (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) >> 32 & 0x7fffffff : -1)
+ (((addr) & (ULONGEST)1 << 63) \
+ ? (CORE_ADDR) ((ULONGEST)(addr) >> 32 & 0x7fffffff) \
+ : -1)
#define SPUADDR_ADDR(addr) \
(((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr))
next reply other threads:[~2009-08-04 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-04 14:51 Tom Tromey [this message]
2009-08-05 13:51 ` Ulrich Weigand
2009-08-05 15:08 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3tz0nhbte.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox