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

            Bug ID: 58846
           Summary: [4.7/4.8/4.9 Regression] ICE redeclaring __dso_handle
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet triggers an ICE since GCC 4.7.0:

========================================
extern "C" { char* __dso_handle; }

struct A
{
  ~A();
};

A a;
========================================

bug.cc:8:3: error: conflicting declaration 'void* __dso_handle'
 A a;
   ^
bug.cc:1:20: note: '__dso_handle' has a previous declaration as 'char*
__dso_handle'
 extern "C" { char* __dso_handle; }
                    ^
bug.cc: In function 'void __static_initialization_and_destruction_0(int, int)':
bug.cc:8:3: internal compiler error: tree check: expected tree that contains
'decl with visibility' structure, have 'error_mark' in get_dso_handle_node, at
cp/decl.c:6687
 A a;
   ^
0xd17204 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/gcc/tree.c:9473
0x577e2c contains_struct_check
        ../../gcc/gcc/tree.h:2788
0x577e2c get_dso_handle_node
        ../../gcc/gcc/cp/decl.c:6687
0x577e2c register_dtor_fn(tree_node*)
        ../../gcc/gcc/cp/decl.c:6856
0x6233c7 one_static_initialization_or_destruction
        ../../gcc/gcc/cp/decl2.c:3502
0x623779 do_static_initialization_or_destruction
        ../../gcc/gcc/cp/decl2.c:3579
0x624fa2 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4214
Please submit a full bug report, [etc.]

Reply via email to