On Tue, 7 Jun 2016, Jakub Jelinek wrote: > On Tue, Jun 07, 2016 at 10:15:39AM +0200, Richard Biener wrote: > > > > This fixes PR61564 by diagnosing (and ignoring) options not marked with > > 'Optimization' being applied to #pragma GCC optimize or via the > > optimize attribute. > > > > The reason is that while we save/restore option state for 'Optimize' > > marked options we don't do that for other options. Thus while such > > options do not end up in the per-function optimize state applying them > > still clobbers the global state. > > > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > > > Ok for trunk? > > Ok (though it surprises me we haven't done that from the beginning).
Yes, I was surprised by that as well... Richard. > > 2016-06-07 Richard Biener <rguent...@suse.de> > > > > PR c/61564 > > * c-common.c (parse_optimize_options): Only apply CL_OPTIMIZATION > > options and warn about others. > > > > * gcc.dg/Wpragmas-1.c: New testcase. > > * gcc.dg/Wattributes-4.c: Likewise.