https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63795
Bug ID: 63795 Summary: Noreturn failure (test case builtin-noret-1.c) Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: fxcoudert at gcc dot gnu.org On x86_64-apple-darwin14, the following noreturn-related testcases fail with internal compiler errors, at optimization levels -Os, -O2 and above: gcc.dg/torture/builtin-noret-1.c gcc.dg/torture/builtin-noret-2.c A reduced testcase is: --------------------------- #pragma weak _exit #pragma weak _Exit void _exit (int i) { __builtin_abort (); } void _Exit (int i) { __builtin_abort (); } --------------------------- The issue is related to to ipa-icf, as demonstrated by the backtrace: * thread #1: tid = 0x68e3f7, 0x00000001007a790a cc1`ipa_merge_profiles(dst=0x0000000000000000, src=0x0000000142c12498) + 10 at ipa-utils.c:413, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) frame #0: 0x00000001007a790a cc1`ipa_merge_profiles(dst=0x0000000000000000, src=0x0000000142c12498) + 10 at ipa-utils.c:413 410 bool match = true; 411 412 if (!src->definition -> 413 || !dst->definition) 414 return; 415 if (src->frequency < dst->frequency) 416 src->frequency = dst->frequency; (lldb) bt * thread #1: tid = 0x68e3f7, 0x00000001007a790a cc1`ipa_merge_profiles(dst=0x0000000000000000, src=0x0000000142c12498) + 10 at ipa-utils.c:413, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) * frame #0: 0x00000001007a790a cc1`ipa_merge_profiles(dst=0x0000000000000000, src=0x0000000142c12498) + 10 at ipa-utils.c:413 frame #1: 0x000000010079300b cc1`ipa_icf::sem_function::merge(this=<unavailable>, alias_item=<unavailable>) + 667 at ipa-icf.c:683 frame #2: 0x000000010079895f cc1`ipa_icf::sem_item_optimizer::merge_classes(this=<unavailable>, prev_class_count=<unavailable>) + 879 at ipa-icf.c:2288 frame #3: 0x000000010079d052 cc1`ipa_icf::sem_item_optimizer::execute(this=0x0000000141e1cfd0) + 338 at ipa-icf.c:1648 frame #4: 0x000000010079de52 cc1`ipa_icf::pass_ipa_icf::execute(this=<unavailable>, (null)=<unavailable>) + 18 at ipa-icf.c:2366 frame #5: 0x000000010088dd7b cc1`execute_one_pass(pass=0x0000000141e0ec50) + 395 at passes.c:2269 frame #6: 0x000000010088ea5a cc1`execute_ipa_pass_list(pass=0x0000000141e0ec50) + 154 at passes.c:2663 frame #7: 0x00000001004d8ec9 cc1`symbol_table::compile() + 197 at cgraphunit.c:2088 frame #8: 0x00000001004d8e04 cc1`symbol_table::compile(this=0x0000000142c05000) + 1188 frame #9: 0x00000001004dad3e cc1`symbol_table::finalize_compilation_unit(this=0x0000000142c05000) + 110 at cgraphunit.c:2325 frame #10: 0x0000000100021109 cc1`c_write_global_declarations() + 601 at c-decl.c:10779 frame #11: 0x0000000100968d4f cc1`compile_file + 143 at toplev.c:583 frame #12: 0x0000000100e80c74 cc1`toplev::main(this=<unavailable>, argc=4, argv=0x00007fff5fbff9b8) + 3764 at toplev.c:2013 frame #13: 0x0000000100e8129c cc1`main(argc=4, argv=0x00007fff5fbff9b8) + 44 at main.c:38 frame #14: 0x00007fff8e0895c9 libdyld.dylib`start + 1 frame #15: 0x00007fff8e0895c9 libdyld.dylib`start + 1