Hi Segher, OK, here is an official submission of my patch to fix PR 68028.
I should note that Richard Guenther feels that there is a better way to solve the problem - by only initializing the values once - but I still like my solution, so I am offering it here. OK to apply ? Cheers Nick gcc/ChangeLog 2018-02-08 Nick Clifton <ni...@redhat.com> * config/rs6000/rs6000.c (rs6000_option_override_internal): In LTO mode prefer function attributes over command line -mcpu setting. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 257282) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -4834,12 +4834,25 @@ if (main_target_opt) { - if (main_target_opt->x_rs6000_single_float != rs6000_single_float) - error ("target attribute or pragma changes single precision floating " - "point"); - if (main_target_opt->x_rs6000_double_float != rs6000_double_float) - error ("target attribute or pragma changes double precision floating " - "point"); + /* PR 68028: In LTO mode the -mcpu value is passed in as a function + attribute rather than on the command line. So instead of checking + for discrepancioes, we enforce the choice determined by the + attributes. */ + if (in_lto_p) + { + rs6000_single_float = main_target_opt->x_rs6000_single_float; + rs6000_double_float = main_target_opt->x_rs6000_double_float; + } + /* There could be an 'else' statement here but it is hardly worth + it as the compiler will make the optimization anyway, and this + way we avoid indenting the code unnecessarily. */ + + if (main_target_opt->x_rs6000_single_float != rs6000_single_float) + error ("target attribute or pragma changes single precision floating " + "point"); + if (main_target_opt->x_rs6000_double_float != rs6000_double_float) + error ("target attribute or pragma changes double precision floating " + "point"); } rs6000_always_hint = (rs6000_tune != PROCESSOR_POWER4