From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23938 invoked by alias); 14 Jun 2002 13:06:06 -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 23910 invoked by uid 71); 14 Jun 2002 13:06:04 -0000 Resent-Date: 14 Jun 2002 13:06:03 -0000 Resent-Message-ID: <20020614130603.23909.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org 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 23616 invoked from network); 14 Jun 2002 13:04:59 -0000 Received: from unknown (HELO pc4) (62.30.255.227) by sources.redhat.com with SMTP; 14 Jun 2002 13:04:59 -0000 Received: from jcownie by etnus.com with local (MasqMail 0.1.16) id 17Iql8-3V7-00 for gcc-gnats@gcc.gnu.org; Fri, 14 Jun 2002 14:04:58 +0100 Message-Id: <17Iql8-3V7-00@etnus.com> Date: Fri, 14 Jun 2002 06:46:00 -0000 From: jcownie@etnus.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c/7030: Bad DWARF with volatile + structs X-SW-Source: 2002-06/txt/msg00326.txt.bz2 List-Id: >Number: 7030 >Category: c >Synopsis: Incorrect DWARF >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Jun 14 06:06:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: James Cownie >Release: 3.1 >Organization: >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.1/configure >Description: This code struct foo { int ia; int ib; }; struct bah { volatile struct foo fa; int fb; }; int main (int argc, char ** argv) { struct foo f; struct bah b; f.ia = 999; f.ib = -999; b.fa = f; { const struct foo cf = f; int i = 0; } } compiled with -g produces DWARF like this % readelf -w foo The section .debug_aranges contains: Length: 28 Version: 2 Offset into .debug_info: 0 Pointer Size: 4 Segment Size: 0 Address Length 08048380 63 Contents of the .debug_pubnames section: Length: 23 Version: 2 Offset into .debug_info section: 0 Size of area in .debug_info section: 339 Offset Name 195 main The section .debug_info contains: Compilation Unit @ 0: Length: 335 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 : 0x80483bf 134513599 DW_AT_low_pc : 0x8048380 134513536 DW_AT_name : tx_struct.c DW_AT_comp_dir : /home1/jim/build/linux_x86/totalview/debugger/src/regress DW_AT_producer : GNU C 3.1 DW_AT_language : 1 (ANSI C) <1><69>: Abbrev Number: 2 (DW_TAG_structure_type) DW_AT_sibling : <90> DW_AT_name : foo DW_AT_byte_size : 8 DW_AT_decl_file : 1 DW_AT_decl_line : 2 <2><75>: Abbrev Number: 3 (DW_TAG_member) DW_AT_name : ia DW_AT_decl_file : 1 DW_AT_decl_line : 3 DW_AT_type : <90> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0; ) <2><82>: Abbrev Number: 3 (DW_TAG_member) DW_AT_name : ib DW_AT_decl_file : 1 DW_AT_decl_line : 4 DW_AT_type : <90> DW_AT_data_member_location: 2 byte block: 23 4 (DW_OP_plus_uconst: 4; ) <1><90>: Abbrev Number: 4 (DW_TAG_base_type) DW_AT_name : int DW_AT_byte_size : 4 DW_AT_encoding : 5 (signed) <1><97>: Abbrev Number: 2 (DW_TAG_structure_type) DW_AT_sibling : DW_AT_name : bah DW_AT_byte_size : 12 DW_AT_decl_file : 1 DW_AT_decl_line : 8 <2>: Abbrev Number: 3 (DW_TAG_member) DW_AT_name : fa DW_AT_decl_file : 1 DW_AT_decl_line : 9 DW_AT_type : DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0; ) <2>: Abbrev Number: 3 (DW_TAG_member) DW_AT_name : fb DW_AT_decl_file : 1 DW_AT_decl_line : 10 DW_AT_type : <90> DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8; ) <1>: Abbrev Number: 5 (DW_TAG_volatile_type) DW_AT_type : <69> <1>: Abbrev Number: 6 (DW_TAG_subprogram) DW_AT_sibling : <139> DW_AT_external : 1 DW_AT_name : main DW_AT_decl_file : 1 DW_AT_decl_line : 14 DW_AT_prototyped : 1 DW_AT_type : <90> DW_AT_low_pc : 0x8048380 134513536 DW_AT_high_pc : 0x80483bf 134513599 DW_AT_frame_base : 1 byte block: 55 (DW_OP_reg5; ) <2>: Abbrev Number: 7 (DW_TAG_formal_parameter) DW_AT_name : argc DW_AT_decl_file : 1 DW_AT_decl_line : 13 DW_AT_type : <90> DW_AT_location : 2 byte block: 91 8 (DW_OP_fbreg: 8; ) <2>: Abbrev Number: 7 (DW_TAG_formal_parameter) DW_AT_name : argv DW_AT_decl_file : 1 DW_AT_decl_line : 13 DW_AT_type : <139> DW_AT_location : 2 byte block: 91 c (DW_OP_fbreg: 12; ) <2>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name : f DW_AT_decl_file : 1 DW_AT_decl_line : 15 DW_AT_type : DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16; ) <2><109>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name : b DW_AT_decl_file : 1 DW_AT_decl_line : 16 DW_AT_type : <97> DW_AT_location : 2 byte block: 91 58 (DW_OP_fbreg: -40; ) <2><115>: Abbrev Number: 9 (DW_TAG_lexical_block) DW_AT_low_pc : 0x80483aa 134513578 DW_AT_high_pc : 0x80483bd 134513597 <3><11e>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name : cf DW_AT_decl_file : 1 DW_AT_decl_line : 24 DW_AT_type : <14d> DW_AT_location : 2 byte block: 91 50 (DW_OP_fbreg: -48; ) <3><12b>: Abbrev Number: 8 (DW_TAG_variable) DW_AT_name : i DW_AT_decl_file : 1 DW_AT_decl_line : 25 DW_AT_type : <90> DW_AT_location : 2 byte block: 91 4c (DW_OP_fbreg: -52; ) <1><139>: Abbrev Number: 10 (DW_TAG_pointer_type) DW_AT_byte_size : 4 DW_AT_type : <13f> <1><13f>: Abbrev Number: 10 (DW_TAG_pointer_type) DW_AT_byte_size : 4 DW_AT_type : <145> <1><145>: Abbrev Number: 4 (DW_TAG_base_type) DW_AT_name : char DW_AT_byte_size : 1 DW_AT_encoding : 6 (signed char) <1><14d>: Abbrev Number: 11 (DW_TAG_const_type) DW_AT_type : Observe that the type of the variable 'f' iat is given as type which is volatile struct foo. However in the source the type is unadorned struct foo. >How-To-Repeat: As above. >Fix: >Release-Note: >Audit-Trail: >Unformatted: