This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA-v2] dwarf2read.c: Avoid complaint for char array of unspecified size



> -----Message d'origine-----
> De?: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé?: Monday, May 24, 2010 5:30 PM
> À?: Pierre Muller
> Cc?: gdb-patches@sourceware.org
> Objet?: Re: [RFA] dwarf2read.c: Avoid complaint for char array of
> unspecified size
> 
> >>>>> "Pierre" == Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
> writes:
> 
> 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?
> 
> Whatever means "unknown bounds" inside gdb.
> I don't remember offhand what this is.
> 
> Pierre>   This would mean that we should fix the code inside
> Pierre>   read_subrange_type, no?
> 
> Pierre>   Do you think that this would be the correct approach?
> 
> Yeah, I do.
> 
> Tom


2010-05-26  Pierre Muller  <muller@ics.u-strasbg.fr>

	* dwarf2read.c (read_subrange_type): Create default subrange
	type if DIE->NUM_ATTRS is zero.

Index: src/gdb/dwarf2read.c
===================================================================
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 = -1;
   char *name;
   LONGEST negative_mask;
-  
+
+  /* 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 == 0)
+    {
+      base_type = objfile_type (cu->objfile)->builtin_int;
+      range_type = create_range_type (NULL, base_type, 0, -1); 
+      return set_die_type (die, range_type, cu);
+    }
+
   base_type = die_type (die, cu);
   if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]