This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA-v2] dwarf2read.c: Avoid complaint for char array of unspecified size
- From: Tom Tromey <tromey at redhat dot com>
- To: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 27 May 2010 14:07:54 -0600
- Subject: Re: [RFA-v2] dwarf2read.c: Avoid complaint for char array of unspecified size
- References: <38685.0063725889$1274473713@news.gmane.org> <m3pr0px76l.fsf@fleche.redhat.com> <002201caf93d$e6ea8190$b4bf84b0$@muller@ics-cnrs.unistra.fr> <m34ohxuxkn.fsf@fleche.redhat.com> <34200.8848595016$1274864816@news.gmane.org>
- Reply-to: tromey at redhat dot com
>>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr> writes:
Pierre> 2010-05-26 Pierre Muller <muller@ics.u-strasbg.fr>
Pierre> * dwarf2read.c (read_subrange_type): Create default subrange
Pierre> type if DIE->NUM_ATTRS is zero.
I think this is an improvement, but it would be preferable to just
directly implement what DWARF specifies:
If the subrange entry has no type attribute describing the basis
type, the basis type is assumed to be the same as the object
described by the lower bound attribute (if it references an
object). If there is no lower bound attribute, or that attribute
does not reference an object, the basis type is the type of the
upper bound or count attribute (if either of them references an
object). If there is no upper bound or count attribute, or neither
references an object, the type is assumed to be the same type, in
the source language of the compilation unit containing the subrange
entry, as a signed integer with the same size as an address on the
target machine.
Pierre> + if (die->num_attrs == 0)
A DW_TAG_subrange_type might have attributes that we ignore. So, I
think there is no need for a check that is this specific; just determine
the type according to the above algorithm, and remove the existing
complaint code.
Tom