https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64340
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 34687 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34687&action=edit gcc5-pr64340.patch Untested fix (well, tested with make check-gnat). The problem seems to be that gnat modifies global_options after toplevel.c (process_options) ends, in this case options like flag_*exceptions*, in other cases flag_strict_aliasing, or other flags. That means those option changes aren't visible in optimization_{default,current}_node that is created at the end of process_options, and if some function doesn't use its own optimization node, it will get the default one. So, if there are any functions with non-default optimization node, or when lto streams that node for functions that didn't have any, those option changes may get lost. Seems those option changes depend on parsing, so process_options is too early, so IMHO we need to recreate the optimization_{default,current}_node trees with the updated options (updating the options in there directly doesn't work, as the options are hashed). Eric/Honza, does this look reasonable to you? flag_ipa_ra change seems to be misplaced too, will fix that in a separate patch.