> > this fixes second ICE seen during profiledbootstrap with Ada enabled. > > The problem is that Ada builds some object files with -O2 -O0 (not sure > > why) and these functions get flag_ipa_cp but !optimize. > > # Compile s-excdeb.o without optimization and with debug info to let the > # debugger set breakpoints and inspect subprogram parameters on exception > # related events. > > We could probably try wih -Og these days.
That sounds like a good idea to me :) Using -O0 and -fprofile-generate triggers yet another problem. The module gets a constructor function registering the profile info and TARGET_OPTIMIZATION_NODE is not set for it (because it is built after free lang data). This eventually makes ipa-cp to think that the function is compiled with -O2 (because WPA is invoked with -O2) and ICE again. I am testing the following: Index: ipa.c =================================================================== --- ipa.c (revision 278094) +++ ipa.c (working copy) @@ -914,7 +914,10 @@ cgraph_build_static_cdtor_1 (char which, void cgraph_build_static_cdtor (char which, tree body, int priority) { - cgraph_build_static_cdtor_1 (which, body, priority, false, NULL, NULL); + gcc_assert (!in_lto_p); + cgraph_build_static_cdtor_1 (which, body, priority, false, + optimization_default_node, + target_option_default_node); } /* When target does not have ctors and dtors, we call all constructor