This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

debug/9565: g77 outputs incorrect DWARF3 for multidimensional arrays


>Number:         9565
>Category:       debug
>Synopsis:       g77 outputs incorrect DWARF3 for multidimensional arrays
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 04 10:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     James Cownie
>Release:        3.2.1
>Organization:
Etnus LLC
>Environment:
System: Linux pc4 2.4.18 #1 Tue Apr 2 10:17:01 BST 2002 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home1/GNU/gcc-3.2.1/configure 
>Description:
g77 emits DWARF in which the bounds of multi-dimensional arrays are
described back to front.

The DWARF standard is quite clear (page 65 of DWARF 3 draft8) 
  "Each array dimension is described by a debugging information entry
  with either the tag DW_TAG_subrange_type or the tag
  DW_TAG_enumeration_type. These entries are children of the array type
  entry and are ordered to reflect the appearance of the dimensions in
  the source program (i.e. leftmost dimension first, next leftmost
  second, and so on)."

However for a code like this
      program array
      integer ia (3,7)
      end

g77 emits dwarf like this 
jcownie@pc4: readelf -wi array.o
The section .debug_info contains:

  Compilation Unit @ 0:
   Length:        100
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0	
     DW_AT_high_pc     : 0x1a 26	
     DW_AT_low_pc      : 0 0	
     DW_AT_name        : (indirect string, offset: 0x7): array.f	
     DW_AT_comp_dir    : (indirect string, offset: 0xf): /home1/jim/build/linux_x86/totalview/debugger/src/regress	
     DW_AT_producer    : (indirect string, offset: 0x49): GNU F77 3.2.1	
     DW_AT_language    : 7	(FORTRAN 77)
 <1><25>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_sibling     : <4a>	
     DW_AT_external    : 1	
     DW_AT_name        : (indirect string, offset: 0x0): MAIN__	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 1	
     DW_AT_low_pc      : 0 0	
     DW_AT_high_pc     : 0x1a 26	
     DW_AT_frame_base  : 1 byte block: 55 	(DW_OP_reg5; )
 <2><3b>: Abbrev Number: 3 (DW_TAG_variable)
     DW_AT_name        : ia	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 2	
     DW_AT_type        : <4a>	
     DW_AT_location    : 3 byte block: 91 98 7f 	(DW_OP_fbreg: -104; )
 <1><4a>: Abbrev Number: 4 (DW_TAG_array_type)
     DW_AT_sibling     : <60>	
     DW_AT_type        : <60>	
 <2><53>: Abbrev Number: 5 (DW_TAG_subrange_type)
     DW_AT_type        : <60>	
     DW_AT_upper_bound : 7	
 <2><59>: Abbrev Number: 5 (DW_TAG_subrange_type)
     DW_AT_type        : <60>	
     DW_AT_upper_bound : 3	
 <1><60>: Abbrev Number: 6 (DW_TAG_base_type)
     DW_AT_name        : (indirect string, offset: 0x57): integer	
     DW_AT_byte_size   : 4	
     DW_AT_encoding    : 5	(signed)

Note that ia is described as an array (7,3), rather than the correct (3,7)

>How-To-Repeat:
As above.

>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]