RFA: save/restore target options in handle_optimize_attribute

Martin Liška mliska@suse.cz
Tue Jun 1 13:55:13 GMT 2021


On 5/19/21 11:48 PM, Joern Wolfgang Rennecke wrote:
> We set default for some target options in TARGET_OPTION_OPTIMIZATION_TABLE,
> but these can be overridden by specifying the corresponding explicit
> -mXXX / -mno-XXX options.
> When a function bears the attribue
> __attribute__ ((optimize("02")))
> the target options are set to the default for that optimization level,
> which can be different from what was selected for the file as a whole.
> As handle_optimize_attribute is right now, it will thus clobber the
> target options, and with enable_checking it will then abort.
> 
> The attached patch makes it save and restore the target options.
> 
> Bootstrapped and regression tested on x86_64-pc-linux-gnu.
> 

Btw. do you have a test-case we can add for this patch?

Thanks,
Martin


More information about the Gcc-patches mailing list