https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67641

            Bug ID: 67641
           Summary: gcc segfaults when compiling in debug mode
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36350
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36350&action=edit
files to reproduce

The below steps cause gcc to segfault when building with a recent version from
trunk:

g++ (GCC) 6.0.0 20150915 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## Steps to Reproduce
1. unpack the tartar (I couldn't reproduce if I preprocessed the code)
2. Change into the director and run the following
g++ -I. -g -c -o core-test.o core-test.cpp

## Stack Trace
rnburn@localhost ~/bugs/gcc_test_segfault/segfault $ /home/rnburn/local/bin/g++
-I. -g -c -o core-test.o core-test.cpp 
In file included from /home/rnburn/local/include/c++/6.0.0/map:61:0,
                 from ./catch.hpp:3331,
                 from core-test.cpp:2:
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h: In instantiation of ‘class
std::map<std::__cxx11::basic_string<char>,
Catch::SectionTracking::TrackedSection>’:
./catch.hpp:4856:25:   required from here
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h:96:11: error:
TYPE_CANONICAL is not compatible
     class map
           ^
 <record_type 0x7f7fef075498 TrackedSection readonly type_1 type_5 type_6 VOID
    align 8 symtab 0 alias set -1 canonical type 0x7f7fef075498
    fields <const_decl 0x7f7fef856700 Completed
        type <enumeral_type 0x7f7fef0731f8 RunState type <integer_type
0x7f7fef0732a0 unsigned int>
            asm_written unsigned SI
            size <integer_cst 0x7f7ff440c0a8 constant 32>
            unit size <integer_cst 0x7f7ff440c0c0 constant 4>
            align 32 symtab -291691504 alias set -1 canonical type
0x7f7fef0731f8 precision 32 min <integer_cst 0x7f7ff440c0d8 0> max <integer_cst
0x7f7ff440c090 4294967295>
            values <tree_list 0x7f7fef40aa50
                purpose <identifier_node 0x7f7ff31c8aa8 NotStarted
                    bindings <(nil)>
                    local bindings <(nil)>> value <const_decl 0x7f7fef8564d0
NotStarted>
                chain <tree_list 0x7f7fef40aa78
                    purpose <identifier_node 0x7f7ff31c8b00 Executing
                        bindings <(nil)>
                        local bindings <(nil)>> value <const_decl
0x7f7fef8565b0 Executing>
                    chain <tree_list 0x7f7fef40aac8
                        purpose <identifier_node 0x7f7ff31c8b58
ExecutingChildren
                            bindings <(nil)>
                            local bindings <(nil)>> value <const_decl
0x7f7fef856620 ExecutingChildren>
                        chain <tree_list 0x7f7fef40aaf0 purpose
<identifier_node 0x7f7ff31c8bb0 Completed> value <const_decl 0x7f7fef856700
Completed>>>>> context <record_type 0x7f7fef071d20 TrackedSection>
            chain <type_decl 0x7f7fee9b7850 RunState>>
        readonly constant VOID file ./catch.hpp line 4811 col 13
        align 1 context <enumeral_type 0x7f7fef0731f8 RunState> initial
<integer_cst 0x7f7ff13ccf18 3>
        chain <const_decl 0x7f7fef856620 ExecutingChildren type <enumeral_type
0x7f7fef0731f8 RunState>
            readonly constant VOID file ./catch.hpp line 4810 col 13
            align 1 context <enumeral_type 0x7f7fef0731f8 RunState> initial
<integer_cst 0x7f7ff13ccee8 2> chain <const_decl 0x7f7fef8565b0 Executing>>>
context <namespace_decl 0x7f7fee9a7558 SectionTracking>
    full-name "const class Catch::SectionTracking::TrackedSection"
    n_parents=0 use_template=0 interface-unknown
    pointer_to_this <pointer_type 0x7f7fef0755e8> reference_to_this
<reference_type 0x7f7feeb6a0a8>>
 <record_type 0x7f7feeb63f18 mapped_type readonly used type_1 type_5 type_6
VOID
    align 8 symtab 0 alias set -1 canonical type 0x7f7fef075498
    fields <field_decl 0x7f7fee9b7ed8 m_runState
        type <enumeral_type 0x7f7fef0731f8 RunState type <integer_type
0x7f7fef0732a0 unsigned int>
            asm_written unsigned SI
            size <integer_cst 0x7f7ff440c0a8 constant 32>
            unit size <integer_cst 0x7f7ff440c0c0 constant 4>
            align 32 symtab -291691504 alias set -1 canonical type
0x7f7fef0731f8 precision 32 min <integer_cst 0x7f7ff440c0d8 0> max <integer_cst
0x7f7ff440c090 4294967295>
            values <tree_list 0x7f7fef40aa50
                purpose <identifier_node 0x7f7ff31c8aa8 NotStarted
                    bindings <(nil)>
                    local bindings <(nil)>> value <const_decl 0x7f7fef8564d0
NotStarted>
                chain <tree_list 0x7f7fef40aa78
                    purpose <identifier_node 0x7f7ff31c8b00 Executing
                        bindings <(nil)>
                        local bindings <(nil)>> value <const_decl
0x7f7fef8565b0 Executing>
                    chain <tree_list 0x7f7fef40aac8
                        purpose <identifier_node 0x7f7ff31c8b58
ExecutingChildren
                            bindings <(nil)>
                            local bindings <(nil)>> value <const_decl
0x7f7fef856620 ExecutingChildren>
                        chain <tree_list 0x7f7fef40aaf0 purpose
<identifier_node 0x7f7ff31c8bb0 Completed> value <const_decl 0x7f7fef856700
Completed>>>>> context <record_type 0x7f7fef071d20 TrackedSection>
            chain <type_decl 0x7f7fee9b7850 RunState>>
        private decl_3 VOID file ./catch.hpp line 4855 col 18
        align 1 offset_align 1 context <record_type 0x7f7fef071d20
TrackedSection>
        chain <field_decl 0x7f7fee9b7da8 m_name type <record_type
0x7f7ff3202c78 string>
            private decl_3 VOID file ./catch.hpp line 4854 col 21
            align 1 offset_align 1 context <record_type 0x7f7fef071d20
TrackedSection> chain <const_decl 0x7f7fef856700 Completed>>> context
<namespace_decl 0x7f7fee9a7558 SectionTracking>
    full-name "const mapped_type"
    n_parents=0 use_template=0 interface-unknown reference_to_this
<reference_type 0x7f7feeb6a000>>
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h:96:11: internal compiler
error: verify_type failed
0xf4a3e9 verify_type(tree_node const*)
        ../../gcc/gcc/tree.c:13583
0x9ab124 gen_type_die_with_usage
        ../../gcc/gcc/dwarf2out.c:20707
0x9abc40 gen_type_die_with_usage
        ../../gcc/gcc/dwarf2out.c:20805
0x9ac7a6 gen_type_die
        ../../gcc/gcc/dwarf2out.c:20901
0x9b905f gen_decl_die
        ../../gcc/gcc/dwarf2out.c:21448
0x9aaacc gen_member_die
        ../../gcc/gcc/dwarf2out.c:20399
0x9aaacc gen_struct_or_union_type_die
        ../../gcc/gcc/dwarf2out.c:20483
0x9aaacc gen_tagged_type_die
        ../../gcc/gcc/dwarf2out.c:20684
0x9abc0d gen_type_die_with_usage
        ../../gcc/gcc/dwarf2out.c:20846
0x9ac7a6 gen_type_die
        ../../gcc/gcc/dwarf2out.c:20901
0x9b8de1 gen_decl_die
        ../../gcc/gcc/dwarf2out.c:21487
0x9b989c dwarf2out_decl
        ../../gcc/gcc/dwarf2out.c:21937
0x9b9bcb dwarf2out_type_decl
        ../../gcc/gcc/dwarf2out.c:21647
0xbe84af rest_of_type_compilation(tree_node*, int)
        ../../gcc/gcc/passes.c:339
0x6cfaec finish_struct_1(tree_node*)
        ../../gcc/gcc/cp/class.c:6747
0x6976ac instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:10201
0x6976ac instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:10241
0x73c8ab complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:138
0x63c8a9 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/gcc/cp/decl.c:11053
0x6dff15 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:878
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to