From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16846 invoked by alias); 26 May 2010 09:06:46 -0000 Received: (qmail 16830 invoked by uid 22791); 26 May 2010 09:06:45 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_BJ X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 May 2010 09:06:40 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o4Q96QsJ085224 ; Wed, 26 May 2010 11:06:26 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [IPv6:2001:660:2402:d::12]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o4Q96QnL025507 ; Wed, 26 May 2010 11:06:26 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o4Q96PMH050560 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Wed, 26 May 2010 11:06:26 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Tom Tromey'" Cc: References: <38685.0063725889$1274473713@news.gmane.org> <002201caf93d$e6ea8190$b4bf84b0$@muller@ics-cnrs.unistra.fr> In-Reply-To: Subject: [RFA-v2] dwarf2read.c: Avoid complaint for char array of unspecified size Date: Wed, 26 May 2010 15:21:00 -0000 Message-ID: <000f01cafcb2$c25f8aa0$471e9fe0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" 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: 2010-05/txt/msg00593.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Tom Tromey > Envoy=E9=A0: Monday, May 24, 2010 5:30 PM > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [RFA] dwarf2read.c: Avoid complaint for char array of > unspecified size >=20 > >>>>> "Pierre" =3D=3D Pierre Muller > writes: >=20 > Pierre> But I still don't get the bounds that we should use: > Pierre> lower bound is 0, or 1 for fortran (default value), > Pierre> but should upper bound be equal to lower bound or lower bound - > 1? >=20 > Whatever means "unknown bounds" inside gdb. > I don't remember offhand what this is. >=20 > Pierre> This would mean that we should fix the code inside > Pierre> read_subrange_type, no? >=20 > Pierre> Do you think that this would be the correct approach? >=20 > Yeah, I do. >=20 > Tom 2010-05-26 Pierre Muller * dwarf2read.c (read_subrange_type): Create default subrange type if DIE->NUM_ATTRS is zero. Index: src/gdb/dwarf2read.c =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/dwarf2read.c,v retrieving revision 1.388 diff -u -p -r1.388 dwarf2read.c --- src/gdb/dwarf2read.c 21 May 2010 20:45:19 -0000 1.388 +++ src/gdb/dwarf2read.c 26 May 2010 08:41:36 -0000 @@ -6129,7 +6129,20 @@ read_subrange_type (struct die_info *die LONGEST high =3D -1; char *name; LONGEST negative_mask; -=20=20 + + /* Dwarf-2 specifications explicitly allows to create subrange types + without speciying anything, no base_type, no lower and no upper + bound. This kind of empty subrange die is created for instance by GCC + for the following C code: + extern char gdb_int []; + */ + if (die->num_attrs =3D=3D 0) + { + base_type =3D objfile_type (cu->objfile)->builtin_int; + range_type =3D create_range_type (NULL, base_type, 0, -1);=20 + return set_die_type (die, range_type, cu); + } + base_type =3D die_type (die, cu); if (TYPE_CODE (base_type) =3D=3D TYPE_CODE_VOID) {