https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:8f1cb70d7ca6a8da7f6bc7f43fb5e758c0ce88b5 commit r11-6547-g8f1cb70d7ca6a8da7f6bc7f43fb5e758c0ce88b5 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri Jan 8 12:28:25 2021 +0100 i386: Fix -mcmodel= vs. target attribute [PR98585] My patch to save/restore opts_set rather than essentially treating global_options_set as a logical or whether some option has ever been explicitly set somewhere apparently broke -mcmodel= vs. target attribute (and as the patch shows some other options too). The thing is, at least for options for which we ever test opts_set->x_* or global_options_set.x_*, we need to save/restore them next to the saving/restoring of the actual option values. If an option has Save keyword or in case of TargetVariable, it is the generic code that handles the saving and restoring of both the option and corresponding opts_set flag automatically, for other variables (TargetSave, or Target without Save) the backend needs to do that in the target hook manually and in that case should save/restore both the option values (the hooks mostly did that) and opts_set (they didn't). As it seems much easier to let the automatic saving/restoring do the work for us unless the saving/restoring of the option needs some specific magic, the following patch is a result of grepping through the backend for opts_set->x_ and global_options_set.x_ and for all such referenced variables, grepping whether it is saved/restored including opts_set properly in the generated options-save.c or not. 2021-01-08 Jakub Jelinek <ja...@redhat.com> PR target/98585 * config/i386/i386.opt (ix86_cmodel, ix86_incoming_stack_boundary_arg, ix86_pmode, ix86_preferred_stack_boundary_arg, ix86_regparm, ix86_veclibabi_type): Remove x_ prefix, use TargetVariable instead of TargetSave and initialize for variables with enum types. (mfentry, mstack-protector-guard-reg=, mstack-protector-guard-offset=, mstack-protector-guard-symbol=): Add Save. * config/i386/i386-options.c (ix86_function_specific_save, ix86_function_specific_restore): Don't save or restore x_ix86_cmodel, x_ix86_incoming_stack_boundary_arg, x_ix86_pmode, x_ix86_preferred_stack_boundary_arg, x_ix86_regparm, x_ix86_veclibabi_type. * gcc.target/i386/pr98585.c: New test.