From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31181 invoked by alias); 4 Aug 2009 14:51:36 -0000 Received: (qmail 31170 invoked by uid 22791); 4 Aug 2009 14:51:35 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_73,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Aug 2009 14:51:30 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n74EpTOg021071 for ; Tue, 4 Aug 2009 10:51:29 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n74EpRGB004033; Tue, 4 Aug 2009 10:51:28 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n74EpQX0022521; Tue, 4 Aug 2009 10:51:27 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 70B6E3784B8; Tue, 4 Aug 2009 08:51:26 -0600 (MDT) To: gdb-patches@sourceware.org Subject: RFA: fix warning building spu-tdep.c From: Tom Tromey Reply-To: tromey@redhat.com Date: Tue, 04 Aug 2009 14:51:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00047.txt.bz2 I got this error while building gdb cvs on x86 F11 yesterday: ../../src/gdb/spu-tdep.c: In function =E2=80=98spu_gdbarch_id=E2=80=99: ../../src/gdb/spu-tdep.c:362: error: overflow in implicit constant conversi= on ../../src/gdb/spu-tdep.c: In function =E2=80=98gdb_print_insn_spu=E2=80=99: ../../src/gdb/spu-tdep.c:1597: error: overflow in implicit constant convers= ion ../../src/gdb/spu-tdep.c: In function =E2=80=98spu_overlay_update_osect=E2= =80=99: ../../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 * spu-tdep.h (SPUADDR_SPU): Cast result to CORE_ADDR. Index: spu-tdep.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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) !=3D -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (ad= dr)) #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)) =20