Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Tom Tromey'" <tromey@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: [RFA-v2] dwarf2read.c: Avoid complaint for char array of unspecified size
Date: Wed, 26 May 2010 15:21:00 -0000	[thread overview]
Message-ID: <000f01cafcb2$c25f8aa0$471e9fe0$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <m34ohxuxkn.fsf@fleche.redhat.com>



> -----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)
     {


  reply	other threads:[~2010-05-26  9:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38685.0063725889$1274473713@news.gmane.org>
2010-05-21 22:13 ` [RFA] " Tom Tromey
2010-05-21 23:55   ` Pierre Muller
2010-05-24 15:35     ` Tom Tromey
2010-05-26 15:21       ` Pierre Muller [this message]
     [not found]       ` <34200.8848595016$1274864816@news.gmane.org>
2010-05-27 20:09         ` [RFA-v2] " Tom Tromey
2010-05-28 10:17           ` [RFA-v3] " Pierre Muller
2010-06-01 19:07             ` Tom Tromey
2010-06-02  6:25               ` Pierre Muller
2010-06-02 19:35                 ` 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='000f01cafcb2$c25f8aa0$471e9fe0$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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