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

            Bug ID: 58502
           Summary: ICE with attribute(target) and -flto
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following valid code snippet triggers an ICE since GCC 4.8.0 when compiled
with "g++ -flto"

========================================================
int foo();
int foo() __attribute__((target("default")));
int foo() __attribute__((target("arch=core2")));

int bar()
{
  return foo();
}
========================================================

bug.cc: In function 'foo() [clone .resolver]':
bug.cc:8:1: internal compiler error: Segmentation fault
 }
 ^
0xae93df crash_signal
        ../../gcc/gcc/toplev.c:335
0xa092c1 contains_struct_check
        ../../gcc/gcc/tree.h:2717
0xa092c1 tree_is_indexable
        ../../gcc/gcc/lto-streamer-out.c:131
0xa0f10f lto_output_tree(output_block*, tree_node*, bool, bool)
        ../../gcc/gcc/lto-streamer-out.c:1298
0xa0faf7 output_function
        ../../gcc/gcc/lto-streamer-out.c:1771
0xa0faf7 lto_output
        ../../gcc/gcc/lto-streamer-out.c:1997
0xa45230 ipa_write_summaries_2
        ../../gcc/gcc/passes.c:2283
0xa462a9 ipa_write_summaries_1
        ../../gcc/gcc/passes.c:2314
0xa462a9 ipa_write_summaries()
        ../../gcc/gcc/passes.c:2371
0x7fcfa4 ipa_passes
        ../../gcc/gcc/cgraphunit.c:2019
0x7fcfa4 compile()
        ../../gcc/gcc/cgraphunit.c:2115
0x7fd229 finalize_compilation_unit()
        ../../gcc/gcc/cgraphunit.c:2269
0x6112b0 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4360
Please submit a full bug report, [etc.]

The code compiles fine if I use the C front-end.

Reply via email to