public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86
@ 2021-01-07 17:04 law at redhat dot com
  2021-01-07 18:27 ` [Bug target/98585] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: law at redhat dot com @ 2021-01-07 17:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

            Bug ID: 98585
           Summary: [11 Regression] target attribute resets cmodel on x86
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at redhat dot com
                CC: hjl.tools at gmail dot com, jakub at redhat dot com
  Target Milestone: ---

Using the "target" attribute on x86 causes a reset of the cmodel from the
command line.

Compile this testcase with -mcmodel-large with gcc-10.  You will see that we
use movabsq to load the address of "bar" into a register and use an indirect
jump.  With gcc-11 we make a direct jump/call.  This causes grub2 to FTBFS in
Fedora rawhide and RHEL 9.

This appears to be caused by ba948b37768c99cd8eb9f5b6fbd45fcf4bd15b78

void bar (void);

void
__attribute__ ((target ("bmi2")))
foo()
{
  bar ();
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
@ 2021-01-07 18:27 ` jakub at gcc dot gnu.org
  2021-01-07 19:29 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-07 18:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-01-07
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Target Milestone|---                         |11.0
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'll have a look then.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
  2021-01-07 18:27 ` [Bug target/98585] " jakub at gcc dot gnu.org
@ 2021-01-07 19:29 ` jakub at gcc dot gnu.org
  2021-01-07 20:27 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-07 19:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
r11-3183-gba948b37768c99cd8eb9f5b6fbd45fcf4bd15b78

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
  2021-01-07 18:27 ` [Bug target/98585] " jakub at gcc dot gnu.org
  2021-01-07 19:29 ` jakub at gcc dot gnu.org
@ 2021-01-07 20:27 ` jakub at gcc dot gnu.org
  2021-01-08  8:28 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-07 20:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49916
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49916&action=edit
gcc11-pr98585.patch

Untested fix.  The problem is that if we have TargetSave or something without
Save attribute and use it in opts_set->x_* or global_options_set.x_* tests,
the generic code doesn't save/restore those, so either the target save/restore
options hook needs to save/restore not just the options (which it does for some
of them), but also the opts_set-> for that.  Either it can do that manually, or
by changing TargetSave to TargetVariable we can just leave to the generic code
to do it for us.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
                   ` (2 preceding siblings ...)
  2021-01-07 20:27 ` jakub at gcc dot gnu.org
@ 2021-01-08  8:28 ` rguenth at gcc dot gnu.org
  2021-01-08 11:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-08  8:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
      Known to work|                            |10.2.0
             Target|                            |x86_64-*-* i?86-*-*

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
                   ` (3 preceding siblings ...)
  2021-01-08  8:28 ` rguenth at gcc dot gnu.org
@ 2021-01-08 11:29 ` cvs-commit at gcc dot gnu.org
  2021-01-08 11:31 ` jakub at gcc dot gnu.org
  2021-01-08 11:32 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-08 11:29 UTC (permalink / raw)
  To: gcc-bugs

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 <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8f1cb70d7ca6a8da7f6bc7f43fb5e758c0ce88b5

commit r11-6547-g8f1cb70d7ca6a8da7f6bc7f43fb5e758c0ce88b5
Author: Jakub Jelinek <jakub@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  <jakub@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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
                   ` (4 preceding siblings ...)
  2021-01-08 11:29 ` cvs-commit at gcc dot gnu.org
@ 2021-01-08 11:31 ` jakub at gcc dot gnu.org
  2021-01-08 11:32 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-08 11:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/98585] [11 Regression] target attribute resets cmodel on x86
  2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
                   ` (5 preceding siblings ...)
  2021-01-08 11:31 ` jakub at gcc dot gnu.org
@ 2021-01-08 11:32 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-08 11:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98585

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 97469 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-08 11:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-07 17:04 [Bug target/98585] New: [11 Regression] target attribute resets cmodel on x86 law at redhat dot com
2021-01-07 18:27 ` [Bug target/98585] " jakub at gcc dot gnu.org
2021-01-07 19:29 ` jakub at gcc dot gnu.org
2021-01-07 20:27 ` jakub at gcc dot gnu.org
2021-01-08  8:28 ` rguenth at gcc dot gnu.org
2021-01-08 11:29 ` cvs-commit at gcc dot gnu.org
2021-01-08 11:31 ` jakub at gcc dot gnu.org
2021-01-08 11:32 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).