This is the mail archive of the gdb-prs@sources.redhat.com 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]

pending/1386: Re: Dwarf2-related Internal error


>Number:         1386
>Category:       pending
>Synopsis:       Re: Dwarf2-related Internal error
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   unknown
>Arrival-Date:   Sat Sep 20 21:38:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 This is a multi-part message in MIME format.
 --------------020108090209050409010408
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Michal Ludvig told me that:
 > OK, I have found the problem. The type of the parameter 'xx' is an array 
 > with unspecified size. Lower bound is set to '1' for Fortran and since 
 > there is no upper bound specified, it's set to '-1' by default.
 > 
 > 3097     else if (attr->form == DW_FORM_block1)
 > 3098     {
 > 3099       /* GCC encodes arrays with unspecified or dynamic length
 > 3100          with a DW_FORM_block1 attribute.
 > 3101          FIXME: GDB does not yet know how to handle dynamic
 > 3102          arrays properly, treat them as arrays with unspecified
 > 3103          length for now.  */
 > 3104       high = -1;
 > 3105     }
 > 
 > Later, when the actual size of the array type is computed, it takes the 
 > size of the main type (real, size=4) and multiplies it by 
 > (high-low+1=-1) leading to -4 which is quite a big number when converted 
 > to unsigned.
 > 
 > Now how to solve it. For now I did
 > 
 >                      length for now.  */
 >                   high = -1;
 > +                 if (cu_language == language_fortran)
 > +                   high = 0;
 >                 }
 > 
 > which at least prevents GDB from crashing. IMHO it achieves the same 
 > behaviour as for other languages, where low=0, high=-1 and so the size 
 > of the array results to 0. In fortran low=1, so with high=0 the size 
 > will become 0 as well.
 > 
 > Would this be an acceptable solution? Any comments?
 
 PING!
 http://sources.redhat.com/ml/gdb/2003-08/msg00150.html
 
 Any comments? Tha patch is attached. It proved to work pretty well - can 
 I apply it?
 
 Thanks!
 
 Michal Ludvig
 -- 
 SuSE CR, s.r.o             mludvig@suse.cz | I would like to change
 (+420) 296.545.373      http://www.suse.cz | the world, but they wont
 Personal homepage http://www.logix.cz/~mic | tell me the source code.
 
 --------------020108090209050409010408
 Content-Type: text/plain;
  name="pgi-array-1.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="pgi-array-1.diff"
 
 2003-09-17  Michal Ludvig  <mludvig@suse.cz>
 
 	* dwarf2read.c (read_array_type): Set upper bound for
 	Fortran arrays of unspecified size.
 
 Index: dwarf2read.c
 ===================================================================
 RCS file: /cvs/src/src/gdb/dwarf2read.c,v
 retrieving revision 1.105
 diff -u -p -r1.105 dwarf2read.c
 --- dwarf2read.c	15 Sep 2003 17:19:23 -0000	1.105
 +++ dwarf2read.c	17 Sep 2003 10:53:35 -0000
 @@ -3239,6 +3239,8 @@ read_array_type (struct die_info *die, s
  		     arrays properly, treat them as arrays with unspecified
  		     length for now.  */
  		  high = -1;
 +		  if (cu_language == language_fortran)
 +		    high = 0;
  		}
  	      else
  		{
 
 --------------020108090209050409010408--
 
 
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


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