https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64340
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- It's fixed by dropping all of TI_TARGET_OPTION_DEFAULT, TI_TARGET_OPTION_CURRENT, TI_CURRENT_TARGET_PRAGMA and TI_CURRENT_OPTIMIZE_PRAGMA from the special-casing. We are trying to expand a GIMPLE_RESX stmt which should have been lowered before. (gdb) p opts_for_fn (cfun->decl)->x_flag_exceptions $3 = 0 '\000' thus somehow -fexceptions is bogus (also in 'Optimization' for some weird reason). (gdb) p global_options.x_flag_exceptions $4 = 0 But certainly -fexceptions -fnon-call-exceptions was specified for both source TUs and thus via lto-wrapper xgcc should have received them. But lto1 seems to ignore -fexceptions. I've reproduced pasting the gnatmake command and then (gnatlink fails) ./lto1 -quiet lto8.o lto8_pkg.o -fexceptions -fnon-call-exceptions The bogus setting is "restored" via Hardware watchpoint 5: *$3 Old value = 1 New value = 0 cl_optimization_restore (opts=0x203fc80 <global_options>, ptr=0x7ffff6c344b0) at options-save.c:476 476 opts->x_flag_expensive_optimizations = ptr->x_flag_expensive_optimizations; #0 cl_optimization_restore (opts=0x203fc80 <global_options>, ptr=0x7ffff6c344b0) at options-save.c:476 #1 0x00000000008f4603 in invoke_set_current_function_hook (fndecl= <function_decl 0x7ffff6e1a000 lto8___finalizer>) at /space/rguenther/src/svn/trunk2/gcc/function.c:4665 #2 0x00000000008f4909 in allocate_struct_function ( fndecl=<function_decl 0x7ffff6e1a000 lto8___finalizer>, abstract_p=false) at /space/rguenther/src/svn/trunk2/gcc/function.c:4777 #3 0x00000000008f4b09 in push_struct_function ( fndecl=<function_decl 0x7ffff6e1a000 lto8___finalizer>) at /space/rguenther/src/svn/trunk2/gcc/function.c:4819 #4 0x0000000000aed772 in input_function ( fn_decl=<function_decl 0x7ffff6e1a000 lto8___finalizer>, data_in=0x2062810, ib=0x7fffffffdad0, ib_cfg=0x7fffffffdac0) at /space/rguenther/src/svn/trunk2/gcc/lto-streamer-in.c:945 #5 0x0000000000aee06d in lto_read_body_or_constructor ( file_data=0x7ffff7ff6000, node=0x7ffff6c347a8, data=0x20a2540 "\004", section_type=LTO_section_function_body) at /space/rguenther/src/svn/trunk2/gcc/lto-streamer-in.c:1108 #6 0x0000000000aee311 in lto_input_function_body (file_data=0x7ffff7ff6000, node=<cgraph_node* 0x7ffff6c347a8 "lto8___finalizer">, data=0x20a2540 "\004") at /space/rguenther/src/svn/trunk2/gcc/lto-streamer-in.c:1153 now the question is why there is false for those options in the function specific optimization nodes. When do we populate these?