[Bug c++/61564] #pragma GCC optimize ("-fno-lto") causes the compiler to crash
rguenther at suse dot de
gcc-bugzilla@gcc.gnu.org
Wed Jun 8 07:03:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61564
--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 7 Jun 2016, manu at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61564
>
> Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |manu at gcc dot gnu.org
>
> --- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #3)
> > It looks like both the pragma and the attribute accept any kind of -f/-O
> > options
> > regardless of them being marked as 'Optimization' in the .opt file. They
> > get applied via decode_options and thus may have side-effects not reflected
> > by
> > cl_optimization_save/restore.
> >
> > I have a patch to issue
> >
> > /tmp/t.c:2:9: warning: bad option -fno-lto to pragma attribute [-Wpragmas]
> > #pragma GCC optimize ("-fno-lto")
> > ^~~
>
> to pragma attribute?
>
> Do you mean "to pragma 'optimize'"?
>
> This would be even prettier:
>
> ret = false;
> warning (attr_p ? OPT_Wattributes : OPT_Wpragmas,
> attr_p ? "bad option %qs to attribute %<optimize%>"
> : "bad option %qs to pragma %<optimize>%",
> decoded_options[i].orig_option_with_args_text);
> continue;
These are good suggestions (I verbatim copied the warnings from code a
few lines up). Will prepare a patch to fix all of them.
More information about the Gcc-bugs
mailing list