Fix -Ofast interaction with optimize attributes

H.J. Lu hjl.tools@gmail.com
Fri Feb 18 02:21:00 GMT 2011


On Thu, Feb 17, 2011 at 2:52 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Ian recently fixed an issue where -O<level> options (for levels other
> than "fast") implicitly setting -fno-fast-math overrode front-end
> settings of fast-math options.
>
> Another such issue relates to optimize attributes, which act by
> processing an optimization level (the previous one if none was set in
> the options in that attribute) before processing other options in that
> attribute.  Since there is no global setting for -Ofast, an optimize
> attribute effectively turns -Ofast from the command line into -O3.
> (This is related to PR 38716, but the general problem in that PR is
> not a regression and may be comparatively complicated to fix, while
> the extension to fast-math options is a regression and is
> straightforward to fix.)
>
> This patch arranges for optimize attributes to handle -Ofast
> consistently with other options by adding an associated setting in the
> gcc_options structure.  Bootstrapped with no regressions on
> x86_64-unknown-linux-gnu and committed.
>
> 2011-02-17  Joseph Myers  <joseph@codesourcery.com>
>
>        * common.opt (optimize_fast): New Variable.
>        * opts.c (default_options_optimization): Use opts->x_optimize_fast
>        instead of local variable ofast.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47794

-- 
H.J.



More information about the Gcc-patches mailing list