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]

[Bug c++/36266] New: C++ typedef misplaced in DWARF information


When I compile the following program with trunk g++ (r135576), producing DWARF
debugging output, the die for the "Cursor" typedef appears as a child of the
anonymous union in 'struct Box', not scoped in the 'avmplus' namespace as it
should be.

$ cat Interpreter.ii
typedef unsigned char uint8_t;
namespace avmplus
{
  typedef const uint8_t *Cursor;
  struct Box
  {
    union
    {
      Cursor abcpos;
    };
  };
  const Box boxedNull = { };
}
$ ~/gcc/bin/g++ -v -g -c Interpreter.ii -o Interpreter.o
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/jimb/gcc --disable-bootstrap
--enable-languages=c,c++
Thread model: posix
gcc version 4.4.0 20080519 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-g' '-c' '-o' 'Interpreter.o' '-shared-libgcc'
'-mtune=generic'
 /home/jimb/gcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/cc1plus -fpreprocessed
Interpreter.ii -quiet -dumpbase Interpreter.ii -mtune=generic -auxbase-strip
Interpreter.o -g -version -o /tmp/ccoWmr3t.s
GNU C++ (GCC) version 4.4.0 20080519 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2), GMP version 4.2.1, MPFR version 2.3.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: c0da38a9dd5652951ad007dd747d81af
COLLECT_GCC_OPTIONS='-v' '-g' '-c' '-o' 'Interpreter.o' '-shared-libgcc'
'-mtune=generic'
 as -V -Qy -o Interpreter.o /tmp/ccoWmr3t.s
GNU assembler version 2.18 (i486-linux-gnu) using BFD version (GNU Binutils for
Ubuntu) 2.18
COMPILER_PATH=/home/jimb/gcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/home/jimb/gcc/libexec/gcc/i686-pc-linux-gnu/4.4.0/:/home/jimb/gcc/libexec/gcc/i686-pc-linux-gnu/:/home/jimb/gcc/lib/gcc/i686-pc-linux-gnu/4.4.0/:/home/jimb/gcc/lib/gcc/i686-pc-linux-gnu/
LIBRARY_PATH=/home/jimb/gcc/lib/gcc/i686-pc-linux-gnu/4.4.0/:/home/jimb/gcc/lib/gcc/i686-pc-linux-gnu/4.4.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-c' '-o' 'Interpreter.o' '-shared-libgcc'
'-mtune=generic'
$ readelf -wi Interpreter.o
The section .debug_info contains:

  Compilation Unit @ offset 0x0:
   Length:        160
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
  < c>     DW_AT_producer    : (indirect string, offset: 0x0): GNU C++ 4.4.0
20080519 (experimental)
  <10>     DW_AT_language    : 4        (C++)
  <11>     DW_AT_name        : (indirect string, offset: 0x5f): Interpreter.ii
  <15>     DW_AT_comp_dir    : (indirect string, offset: 0x7d):
/home/jimb/mc/bug-cursor
  <19>     DW_AT_low_pc      : 0
  <1d>     DW_AT_high_pc     : 0
  <21>     DW_AT_stmt_list   : 0
 <1><25>: Abbrev Number: 2 (DW_TAG_typedef)
  <26>     DW_AT_name        : (indirect string, offset: 0x26): uint8_t
  <2a>     DW_AT_decl_file   : 1
  <2b>     DW_AT_decl_line   : 1
  <2c>     DW_AT_type        : <30>
 <1><30>: Abbrev Number: 3 (DW_TAG_base_type)
  <31>     DW_AT_byte_size   : 1
  <32>     DW_AT_encoding    : 8        (unsigned char)
  <33>     DW_AT_name        : (indirect string, offset: 0x3f): unsigned char
 <1><37>: Abbrev Number: 4 (DW_TAG_namespace)
  <38>     DW_AT_name        : (indirect string, offset: 0x6e): avmplus
  <3c>     DW_AT_decl_file   : 1
  <3d>     DW_AT_decl_line   : 3
  <3e>     DW_AT_sibling     : <79>
 <2><42>: Abbrev Number: 5 (DW_TAG_structure_type)
  <43>     DW_AT_name        : Box
  <47>     DW_AT_declaration : 1
  <48>     DW_AT_sibling     : <6c>
 <3><4c>: Abbrev Number: 6 (DW_TAG_union_type)
  <4d>     DW_AT_name        : (indirect string, offset: 0x4d): <anonymous
union>
  <51>     DW_AT_byte_size   : 4
  <52>     DW_AT_decl_file   : 1
  <53>     DW_AT_decl_line   : 8
 <4><54>: Abbrev Number: 2 (DW_TAG_typedef)
  <55>     DW_AT_name        : (indirect string, offset: 0x38): Cursor
  <59>     DW_AT_decl_file   : 1
  <5a>     DW_AT_decl_line   : 4
  <5b>     DW_AT_type        : <79>
 <4><5f>: Abbrev Number: 7 (DW_TAG_member)
  <60>     DW_AT_name        : (indirect string, offset: 0x76): abcpos
  <64>     DW_AT_decl_file   : 1
  <65>     DW_AT_decl_line   : 9
  <66>     DW_AT_type        : <54>
 <2><6c>: Abbrev Number: 8 (DW_TAG_variable)
  <6d>     DW_AT_name        : (indirect string, offset: 0x2e): boxedNull
  <71>     DW_AT_decl_file   : 1
  <72>     DW_AT_decl_line   : 12
  <73>     DW_AT_type        : <99>
  <77>     DW_AT_declaration : 1
 <1><79>: Abbrev Number: 9 (DW_TAG_pointer_type)
  <7a>     DW_AT_byte_size   : 4
  <7b>     DW_AT_type        : <7f>
 <1><7f>: Abbrev Number: 10 (DW_TAG_const_type)
  <80>     DW_AT_type        : <25>
 <1><84>: Abbrev Number: 11 (DW_TAG_structure_type)
  <85>     DW_AT_specification: <42>
  <89>     DW_AT_byte_size   : 4
  <8a>     DW_AT_decl_file   : 1
  <8b>     DW_AT_decl_line   : 6
  <8c>     DW_AT_sibling     : <99>
 <2><90>: Abbrev Number: 12 (DW_TAG_member)
  <91>     DW_AT_type        : <4c>
  <95>     DW_AT_data_member_location: 2 byte block: 23 0      
(DW_OP_plus_uconst: 0)
 <1><99>: Abbrev Number: 10 (DW_TAG_const_type)
  <9a>     DW_AT_type        : <84>
 <1><9e>: Abbrev Number: 13 (DW_TAG_variable)
  <9f>     DW_AT_specification: <6c>

$


-- 
           Summary: C++ typedef misplaced in DWARF information
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jimb at red-bean dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36266


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