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

            Bug ID: 80287
           Summary: C++ crash with __attribute((may_alias))
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bernd.edlinger at hotmail dot de
  Target Milestone: ---

the following change produces a crash:

Index: libstdc++-v3/testsuite/20_util/any/assign/2.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/any/assign/2.cc      (Revision 246605)
+++ libstdc++-v3/testsuite/20_util/any/assign/2.cc      (Arbeitskopie)
@@ -39,7 +39,7 @@
   X2() = default;
   X2(const X2&) { copied = true; }
   X2(X2&& x) noexcept { moved = true; }
-};
+}__attribute((may_alias));

 void test01()
 {


2.cc: In constructor 'X2::X2(X2&&)':
2.cc:92:1: error: type variant differs by TYPE_REF_CAN_ALIAS_ALL.
 }
 ^
 <pointer_type 0x7fa46d95a5e8
    type <record_type 0x7fa46d95a348 X2 sizes-gimplified addressable
asm_written needs-constructing type_1 type_5 type_6 BLK
        size <integer_cst 0x7fa46de49fa8 constant 8>
        unit size <integer_cst 0x7fa46de49fc0 constant 1>
        align 8 symtab 1838508144 alias set -1 canonical type 0x7fa46d95a348
        attributes <tree_list 0x7fa46ddf1348
            purpose <identifier_node 0x7fa46e044360 may_alias
                bindings <(nil)>
                local bindings <(nil)>>>
        fields <type_decl 0x7fa46d95c000 X2 type <record_type 0x7fa46d95a3f0
X2>
            used nonlocal decl_4 VOID file 2.cc line 38 col 1
            align 1 context <record_type 0x7fa46d95a348 X2> result <record_type
0x7fa46d95a348 X2>
           > context <translation_unit_decl 0x7fa46de58168 2.cc>
        full-name "struct X2"
        needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
        pointer_to_this <pointer_type 0x7fa46d95a5e8> reference_to_this
<reference_type 0x7fa46d95a9d8> chain <type_decl 0x7fa46d93fed8 X2>>
    asm_written static unsigned type_6 DI
    size <integer_cst 0x7fa46de49eb8 type <integer_type 0x7fa46de6a0a8
bitsizetype> constant 64>
    unit size <integer_cst 0x7fa46de49ed0 type <integer_type 0x7fa46de6a000
sizetype> constant 8>
    align 64 symtab 1838508384 alias set -1 canonical type 0x7fa46d95a5e8>
 <pointer_type 0x7fa46d95a690
    type <record_type 0x7fa46d95a348 X2 sizes-gimplified addressable
asm_written needs-constructing type_1 type_5 type_6 BLK
        size <integer_cst 0x7fa46de49fa8 constant 8>
        unit size <integer_cst 0x7fa46de49fc0 constant 1>
        align 8 symtab 1838508144 alias set -1 canonical type 0x7fa46d95a348
        attributes <tree_list 0x7fa46ddf1348
            purpose <identifier_node 0x7fa46e044360 may_alias
                bindings <(nil)>
                local bindings <(nil)>>>
        fields <type_decl 0x7fa46d95c000 X2 type <record_type 0x7fa46d95a3f0
X2>
            used nonlocal decl_4 VOID file 2.cc line 38 col 1
            align 1 context <record_type 0x7fa46d95a348 X2> result <record_type
0x7fa46d95a348 X2>
           > context <translation_unit_decl 0x7fa46de58168 2.cc>
        full-name "struct X2"
        needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
        pointer_to_this <pointer_type 0x7fa46d95a5e8> reference_to_this
<reference_type 0x7fa46d95a9d8> chain <type_decl 0x7fa46d93fed8 X2>>
    readonly unsigned DI
    size <integer_cst 0x7fa46de49eb8 type <integer_type 0x7fa46de6a0a8
bitsizetype> constant 64>
    unit size <integer_cst 0x7fa46de49ed0 type <integer_type 0x7fa46de6a000
sizetype> constant 8>
    align 64 symtab 0 alias set -1 canonical type 0x7fa46d95a690>
2.cc:92:1: internal compiler error: verify_type failed
0x103d385 verify_type(tree_node const*)
        ../../gcc-7-20170326/gcc/tree.c:14207
0x9ef7a4 gen_type_die_with_usage
        ../../gcc-7-20170326/gcc/dwarf2out.c:24478
0x9f0f26 gen_type_die
        ../../gcc-7-20170326/gcc/dwarf2out.c:24704
0x9ec5bb gen_decl_die
        ../../gcc-7-20170326/gcc/dwarf2out.c:25371
0x9e852e gen_subprogram_die
        ../../gcc-7-20170326/gcc/dwarf2out.c:22371
0x9ebff9 gen_decl_die
        ../../gcc-7-20170326/gcc/dwarf2out.c:25284
0x9ed03e dwarf2out_decl
        ../../gcc-7-20170326/gcc/dwarf2out.c:25793
0x9eda2e dwarf2out_abstract_function
        ../../gcc-7-20170326/gcc/dwarf2out.c:21656
0x9ec716 gen_decl_die
        ../../gcc-7-20170326/gcc/dwarf2out.c:25239
0x9ed03e dwarf2out_decl
        ../../gcc-7-20170326/gcc/dwarf2out.c:25793
0x9ed4f6 dwarf2out_early_global_decl
        ../../gcc-7-20170326/gcc/dwarf2out.c:25450
0x972f35 symbol_table::finalize_compilation_unit()
        ../../gcc-7-20170326/gcc/cgraphunit.c:2613
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to