From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18445 invoked by alias); 4 Feb 2003 10:16:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18417 invoked by uid 71); 4 Feb 2003 10:16:01 -0000 Resent-Date: 4 Feb 2003 10:16:01 -0000 Resent-Message-ID: <20030204101601.18416.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jcownie@etnus.com Received: (qmail 18002 invoked from network); 4 Feb 2003 10:11:39 -0000 Received: from unknown (HELO pc4) (62.31.94.27) by 172.16.49.205 with SMTP; 4 Feb 2003 10:11:39 -0000 Received: from jcownie by etnus.com with local (MasqMail 0.1.16) id 18g03G-0w2-00 for gcc-gnats@gcc.gnu.org; Tue, 04 Feb 2003 10:11:38 +0000 Message-Id: <18g03G-0w2-00@etnus.com> Date: Tue, 04 Feb 2003 10:16:00 -0000 From: jcownie@etnus.com Reply-To: jcownie@etnus.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: debug/9565: g77 outputs incorrect DWARF3 for multidimensional arrays X-SW-Source: 2003-02/txt/msg00180.txt.bz2 List-Id: >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>: 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: