public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: jcownie@etnus.com
To: gcc-gnats@gcc.gnu.org
Subject: debug/9565: g77 outputs incorrect DWARF3 for multidimensional arrays
Date: Tue, 04 Feb 2003 10:16:00 -0000	[thread overview]
Message-ID: <18g03G-0w2-00@etnus.com> (raw)


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


                 reply	other threads:[~2003-02-04 10:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=18g03G-0w2-00@etnus.com \
    --to=jcownie@etnus.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).