https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98228
--- Comment #7 from Marius Hillenbrand <mhillen at linux dot ibm.com> --- -flto alone is enough to cause the miscompile. make bootstrap with this config fails in stage3, since the same commit that introduced ipa-modref. when building the Ada runtime libraries with the stage3 gnat, which is the first stage that was compiled with -flto, gnat fails with a segfault: Program received signal SIGSEGV, Segmentation fault. 0x000000000186f062 in sem_type__get_next_interp (i=53941, it=...) at ../../gcc/ada/sem_type.adb:2425 2425 It := All_Interp.Table (I); (gdb) bt #0 0x000000000186f062 in sem_type__get_next_interp (i=53941, it=...) at ../../gcc/ada/sem_type.adb:2425 #1 0x0000000001855966 in sem_res__resolve (n=<optimized out>, typ=<optimized out>) at ../../gcc/ada/atree.adb:1438 #2 0x000000000175c1a6 in sem_res__analyze_and_resolve__2 (typ=1454, n=40376) at ../../gcc/ada/sem_res.adb:329 #3 sem_ch5__analyze_if_statement__analyze_cond_then (cnode=cnode@entry=40375) at ../../gcc/ada/sem_ch5.adb:1801 #4 0x000000000175eaac in sem_ch5__analyze_if_statement (n=<optimized out>) at ../../gcc/ada/sem_ch5.adb:1776 #5 0x0000000001668b3c in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:306 #6 0x000000000175bddc in sem_ch5__analyze_statements (l=<optimized out>) at ../../gcc/ada/table.adb:155 #7 0x000000000169808e in sem_ch11__analyze_handled_statements (n=<optimized out>) at ../../gcc/ada/sem_ch11.adb:426 #8 0x0000000001668e92 in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:297 #9 0x000000000176833a in sem_ch6__analyze_subprogram_body_helper (n=<optimized out>) at ../../gcc/ada/sem_ch6.adb:5204 #10 sem_ch6__analyze_subprogram_body (n=<optimized out>) at ../../gcc/ada/sem_ch6.adb:2818 #11 0x000000000166911c in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:547 #12 0x00000000016f7fb4 in sem_ch3__analyze_declarations (l=<optimized out>) at ../../gcc/ada/table.adb:155 #13 0x00000000017881fa in sem_ch7__analyze_package_body_helper (n=2348) at ../../gcc/ada/sem_ch7.adb:954 #14 sem_ch7__analyze_package_body (n=<optimized out>) at ../../gcc/ada/sem_ch7.adb:180 #15 0x000000000166910e in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:444 #16 0x00000000016931fc in sem_ch10__analyze_compilation_unit (n=<optimized out>) at ../../gcc/ada/sem_ch10.adb:913 #17 0x0000000001668abe in sem__analyze (n=n@entry=2326) at ../../gcc/ada/sem.adb:180 #18 0x0000000001669c8c in sem__semantics__do_analyze () at ../../gcc/ada/sem.adb:1421 #19 sem__semantics (comp_unit=<optimized out>) at ../../gcc/ada/sem.adb:1615 #20 0x00000000015881a4 in _ada_frontend () at ../../gcc/ada/frontend.adb:422 #21 0x000000000193cb1e in _ada_gnat1drv () at ../../gcc/ada/osint.adb:2130 #22 0x00000000012a2be6 in gnat_parse_file () at ../../gcc/ada/gcc-interface/misc.c:118 #23 0x0000000001ee0b2c in compile_file () at ../../gcc/toplev.c:457 #24 0x000000000128ac78 in do_compile () at ../../gcc/toplev.c:2193 #25 _ZN6toplev4mainEiPPc (this=0x3ffffffee5e, argc=<optimized out>, argv=<optimized out>) at ../../gcc/toplev.c:2332 #26 0x000000000128b824 in main (argc=<optimized out>, argv=<optimized out>) at ../../gcc/main.c:39 backtrace from the failure in profiledbootstrap: Breakpoint 2, system__assertions__raise_assert_failure (msg=...) at ../../gcc/ada/libgnat/s-assert.adb:43 43 procedure Raise_Assert_Failure (Msg : String) is (gdb) bt #0 system__assertions__raise_assert_failure (msg=...) at ../../gcc/ada/libgnat/s-assert.adb:43 #1 0x0000000001284eba in atree__ekind (e=<optimized out>) at ../../gcc/ada/atree.adb:931 #2 0x00000000019c5c28 in atree__ekind (e=<optimized out>, e=<optimized out>) at ../../gcc/ada/atree.adb:1438 #3 0x00000000022f0c50 in sem_type__disambiguate (n=<optimized out>, i1=<optimized out>, i2=<optimized out>, typ=1409) at ../../gcc/ada/atree.adb:1438 #4 0x000000000226222e in sem_res__valid_conversion (n=<optimized out>, target=<optimized out>, operand=<optimized out>, report_errs=<optimized out>) at ../../gcc/ada/sem_type.ads:65 #5 0x0000000001ae6bd0 in sem_res__resolve_type_conversion (typ=<optimized out>, n=<optimized out>) at ../../gcc/ada/sem_res.adb:11617 #6 sem_res__resolve (n=<optimized out>, typ=typ@entry=100) at ../../gcc/ada/sem_res.adb:3319 #7 0x0000000001ae707a in sem_res__resolve_op_expon (typ=<optimized out>, n=<optimized out>) at ../../gcc/ada/atree.adb:1438 #8 sem_res__resolve (n=<optimized out>, typ=<optimized out>) at ../../gcc/ada/sem_res.adb:3266 #9 0x00000000020b7c76 in sem_res__resolve_arithmetic_op (n=<optimized out>, typ=<optimized out>) at ../../gcc/ada/sem_res.adb:5637 #10 0x0000000001ae67d2 in sem_res__resolve (n=<optimized out>, typ=<optimized out>) at ../../gcc/ada/atree.adb:1438 #11 0x0000000002269d54 in sem_ch5__analyze_assignment (n=<optimized out>) at ../../gcc/ada/atree.adb:1438 #12 0x0000000001a6617a in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:150 #13 0x0000000001c3db40 in sem_ch5__analyze_statements (l=<optimized out>) at ../../gcc/ada/nlists.adb:953 #14 0x00000000022ff2dc in sem_ch5__analyze_loop_statement (n=<optimized out>) at ../../gcc/ada/sem_ch5.adb:3354 #15 0x0000000001a662c0 in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:336 #16 0x0000000001c3db40 in sem_ch5__analyze_statements (l=<optimized out>) at ../../gcc/ada/nlists.adb:953 #17 0x00000000022299c0 in sem_ch11__analyze_handled_statements (n=<optimized out>) at ../../gcc/ada/sem_ch11.adb:426 #18 0x0000000001a66188 in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:297 #19 0x00000000021957ca in sem_ch6__analyze_subprogram_body_helper (n=<optimized out>) at ../../gcc/ada/sem_ch6.adb:5204 #20 sem_ch6__analyze_subprogram_body (n=<optimized out>) at ../../gcc/ada/sem_ch6.adb:2818 #21 0x0000000001a66196 in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:547 #22 0x0000000001ab7920 in sem_ch3__analyze_declarations (l=<optimized out>) at ../../gcc/ada/sem_ch3.adb:2228 #23 0x00000000021d372c in sem_ch7__analyze_package_body_helper (n=99085) at ../../gcc/ada/sem_ch7.adb:954 #24 sem_ch7__analyze_package_body (n=<optimized out>) at ../../gcc/ada/sem_ch7.adb:180 #25 0x0000000001a66402 in sem__analyze (n=<optimized out>) at ../../gcc/ada/sem.adb:444 #26 0x00000000023b0c28 in sem_ch12__instantiate_subprogram_body (body_info=..., body_optional=<optimized out>) at ../../gcc/ada/atree.adb:1438 #27 0x00000000020ac8d6 in inline__instantiate_bodies () at ../../gcc/ada/table.adb:155 #28 0x0000000001f7f34c in _ada_frontend () at ../../gcc/ada/frontend.adb:436 #29 0x0000000001f549b6 in _ada_gnat1drv () at ../../gcc/ada/osint.adb:2130 #30 0x0000000001f25e98 in gnat_parse_file () at ../../gcc/ada/gcc-interface/misc.c:118 #31 0x0000000001f25b8c in compile_file () at ../../gcc/toplev.c:457 #32 0x0000000001edb4a2 in do_compile () at ../../gcc/toplev.c:2193 #33 _ZN6toplev4mainEiPPc (this=this@entry=0x3ffffffee4e, argc=<optimized out>, argv=<optimized out>) at ../../gcc/toplev.c:2332 #34 0x0000000001eda400 in main (argc=<optimized out>, argv=<optimized out>) at ../../gcc/main.c:39