[PATCH] Fix PR61564 - optimize attribute/pragma accepting any option
Jakub Jelinek
jakub@redhat.com
Tue Jun 7 08:21:00 GMT 2016
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).
> 2016-06-07 Richard Biener <rguenther@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.
Jakub
More information about the Gcc-patches
mailing list