public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings
@ 2021-05-26 11:34 rearnsha at gcc dot gnu.org
  2021-05-26 11:35 ` [Bug target/100767] " rearnsha at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-05-26 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100767
           Summary: arm: ice when inlining at -flto with different cpu and
                    arch settings
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rearnsha at gcc dot gnu.org
  Target Milestone: ---

reproducer:

gcc -O -c -march=armv8-a+simd -flto t1.c
gcc -O -c -mcpu=native -flto main.c
gcc -flto -o main main.o t1.o

Where t1.c is

int f() { return 1;}

and main.c is

int f(void);
int main() { return f(); }

Results in calling strcmp with a NULL argument.  The problem starts in
arm_can_inline_p.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
@ 2021-05-26 11:35 ` rearnsha at gcc dot gnu.org
  2021-05-26 11:54 ` rearnsha at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-05-26 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-05-26
           Assignee|unassigned at gcc dot gnu.org      |rearnsha at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
  2021-05-26 11:35 ` [Bug target/100767] " rearnsha at gcc dot gnu.org
@ 2021-05-26 11:54 ` rearnsha at gcc dot gnu.org
  2021-05-27  9:58 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-05-26 11:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
The problem is that we call arm_configure_build_target() with

  arm_configure_build_target (&caller_target, caller_opts, &global_options_set,
false);

But that doesn't make sense in reality - global_options_set does not describe
what options might have been set on a function compiled in a different LTO
object.  There does not appear to be a opts_set node on a tree object, so the
question is how should this be managed in the general case.

I think I can work around this in the current case, because
arm_configure_build_target only uses the opts_set to decide which string
options to parse and we can do that by checking the option itself for being
non-null.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
  2021-05-26 11:35 ` [Bug target/100767] " rearnsha at gcc dot gnu.org
  2021-05-26 11:54 ` rearnsha at gcc dot gnu.org
@ 2021-05-27  9:58 ` cvs-commit at gcc dot gnu.org
  2021-05-27 10:04 ` rearnsha at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-27  9:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Earnshaw <rearnsha@gcc.gnu.org>:

https://gcc.gnu.org/g:262e75d22c350acbdf4c1fb4f224cc5d3d711eff

commit r12-1089-g262e75d22c350acbdf4c1fb4f224cc5d3d711eff
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Thu May 27 10:25:37 2021 +0100

    arm: Remove use of opts_set in arm_configure_build_target [PR100767]

    The variable global_options_set is a reflection of which options have
    been explicitly set from the command line in the structure
    global_options.  But it doesn't describe the contents of a
    cl_target_option.  cl_target_option is a set of options to apply and
    once configured should represent a viable set of options without
    needing to know which were explicitly set by the user.

    Unfortunately arm_configure_build_target was incorrectly conflating
    the two.  Fortunately, however, we do not really need to know this
    since the various override_options functions should have sanitized the
    target_options values before constructing a cl_target_option
    structure.  It is safe, therefore, to simply drop this parameter to
    arm_configure_build_target and rely on checking that various string
    parameters are non-null before dereferencing them.

    gcc:

            PR target/100767
            * config/arm/arm.c (arm_configure_build_target): Remove parameter
            opts_set, directly check opts parameters for being non-null.
            (arm_option_restore): Update call to arm_configure_build_target.
            (arm_option_override): Likewise.
            (arm_can_inline_p): Likewise.
            (arm_valid_target_attribute_tree): Likewise.
            * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
            * config/arm/arm-protos.h (arm_configure_build_target): Adjust
            prototype.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-27  9:58 ` cvs-commit at gcc dot gnu.org
@ 2021-05-27 10:04 ` rearnsha at gcc dot gnu.org
  2021-05-27 13:29 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-05-27 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
fixed on master so far.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-05-27 10:04 ` rearnsha at gcc dot gnu.org
@ 2021-05-27 13:29 ` cvs-commit at gcc dot gnu.org
  2021-05-27 13:30 ` rearnsha at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-27 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Earnshaw
<rearnsha@gcc.gnu.org>:

https://gcc.gnu.org/g:0faee8bae391fab7e1ba4a494360dd9793e15fb5

commit r11-8473-g0faee8bae391fab7e1ba4a494360dd9793e15fb5
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Thu May 27 10:25:37 2021 +0100

    arm: Remove use of opts_set in arm_configure_build_target [PR100767]

    The variable global_options_set is a reflection of which options have
    been explicitly set from the command line in the structure
    global_options.  But it doesn't describe the contents of a
    cl_target_option.  cl_target_option is a set of options to apply and
    once configured should represent a viable set of options without
    needing to know which were explicitly set by the user.

    Unfortunately arm_configure_build_target was incorrectly conflating
    the two.  Fortunately, however, we do not really need to know this
    since the various override_options functions should have sanitized the
    target_options values before constructing a cl_target_option
    structure.  It is safe, therefore, to simply drop this parameter to
    arm_configure_build_target and rely on checking that various string
    parameters are non-null before dereferencing them.

    gcc:

            PR target/100767
            * config/arm/arm.c (arm_configure_build_target): Remove parameter
            opts_set, directly check opts parameters for being non-null.
            (arm_option_restore): Update call to arm_configure_build_target.
            (arm_option_override): Likewise.
            (arm_can_inline_p): Likewise.
            (arm_valid_target_attribute_tree): Likewise.
            * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
            * config/arm/arm-protos.h (arm_configure_build_target): Adjust
            prototype.

    (cherry picked from commit 262e75d22c350acbdf4c1fb4f224cc5d3d711eff)

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-05-27 13:29 ` cvs-commit at gcc dot gnu.org
@ 2021-05-27 13:30 ` rearnsha at gcc dot gnu.org
  2021-05-27 18:11 ` gabemarcano at yahoo dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-05-27 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Also fixed for gcc-11.  Will consider backporting further, but patches
no-longer apply cleanly on gcc-10.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-05-27 13:30 ` rearnsha at gcc dot gnu.org
@ 2021-05-27 18:11 ` gabemarcano at yahoo dot com
  2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gabemarcano at yahoo dot com @ 2021-05-27 18:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Gabriel Marcano <gabemarcano at yahoo dot com> ---
I was the one that originally reported the issue on gcc-help, and I can confirm
that with the patch the segfault is no longer happening. I do appear to have
found a different bug (undefined references to libc symbols only when using
-flto), but I am no longer seeing an ICE from lto1.

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-05-27 18:11 ` gabemarcano at yahoo dot com
@ 2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
  2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
  2021-08-19 17:20 ` rearnsha at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-19 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Earnshaw
<rearnsha@gcc.gnu.org>:

https://gcc.gnu.org/g:59b5e629a7e4544dc7830638bc20f388c14ef7c8

commit r10-10048-g59b5e629a7e4544dc7830638bc20f388c14ef7c8
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Thu May 27 10:25:37 2021 +0100

    arm: Remove use of opts_set in arm_configure_build_target [PR100767]

    The variable global_options_set is a reflection of which options have
    been explicitly set from the command line in the structure
    global_options.  But it doesn't describe the contents of a
    cl_target_option.  cl_target_option is a set of options to apply and
    once configured should represent a viable set of options without
    needing to know which were explicitly set by the user.

    Unfortunately arm_configure_build_target was incorrectly conflating
    the two.  Fortunately, however, we do not really need to know this
    since the various override_options functions should have sanitized the
    target_options values before constructing a cl_target_option
    structure.  It is safe, therefore, to simply drop this parameter to
    arm_configure_build_target and rely on checking that various string
    parameters are non-null before dereferencing them.

    gcc:

            PR target/100767
            * config/arm/arm.c (arm_configure_build_target): Remove parameter
            opts_set, directly check opts parameters for being non-null.
            (arm_option_restore): Update call to arm_configure_build_target.
            (arm_option_override): Likewise.
            (arm_can_inline_p): Likewise.
            (arm_valid_target_attribute_tree): Likewise.
            * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
            * config/arm/arm-protos.h (arm_configure_build_target): Adjust
            prototype.

    (cherry picked from commit 262e75d22c350acbdf4c1fb4f224cc5d3d711eff)

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
@ 2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
  2021-08-19 17:20 ` rearnsha at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-19 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Earnshaw
<rearnsha@gcc.gnu.org>:

https://gcc.gnu.org/g:255fe52e8ad859f59bb863ad75d00fa84caa88bd

commit r9-9682-g255fe52e8ad859f59bb863ad75d00fa84caa88bd
Author: Richard Earnshaw <rearnsha@arm.com>
Date:   Thu May 27 10:25:37 2021 +0100

    arm: Remove use of opts_set in arm_configure_build_target [PR100767]

    The variable global_options_set is a reflection of which options have
    been explicitly set from the command line in the structure
    global_options.  But it doesn't describe the contents of a
    cl_target_option.  cl_target_option is a set of options to apply and
    once configured should represent a viable set of options without
    needing to know which were explicitly set by the user.

    Unfortunately arm_configure_build_target was incorrectly conflating
    the two.  Fortunately, however, we do not really need to know this
    since the various override_options functions should have sanitized the
    target_options values before constructing a cl_target_option
    structure.  It is safe, therefore, to simply drop this parameter to
    arm_configure_build_target and rely on checking that various string
    parameters are non-null before dereferencing them.

    gcc:

            PR target/100767
            * config/arm/arm.c (arm_configure_build_target): Remove parameter
            opts_set, directly check opts parameters for being non-null.
            (arm_option_restore): Update call to arm_configure_build_target.
            (arm_option_override): Likewise.
            (arm_can_inline_p): Likewise.
            (arm_valid_target_attribute_tree): Likewise.
            * config/arm/arm-c.c (arm_pragma_target_parse): Likewise.
            * config/arm/arm-protos.h (arm_configure_build_target): Adjust
            prototype.

    (cherry picked from commit 262e75d22c350acbdf4c1fb4f224cc5d3d711eff)

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

* [Bug target/100767] arm: ice when inlining at -flto with different cpu and arch settings
  2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
@ 2021-08-19 17:20 ` rearnsha at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2021-08-19 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |9.5
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Fixed on all active branches.

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

end of thread, other threads:[~2021-08-19 17:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 11:34 [Bug target/100767] New: arm: ice when inlining at -flto with different cpu and arch settings rearnsha at gcc dot gnu.org
2021-05-26 11:35 ` [Bug target/100767] " rearnsha at gcc dot gnu.org
2021-05-26 11:54 ` rearnsha at gcc dot gnu.org
2021-05-27  9:58 ` cvs-commit at gcc dot gnu.org
2021-05-27 10:04 ` rearnsha at gcc dot gnu.org
2021-05-27 13:29 ` cvs-commit at gcc dot gnu.org
2021-05-27 13:30 ` rearnsha at gcc dot gnu.org
2021-05-27 18:11 ` gabemarcano at yahoo dot com
2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
2021-08-19 16:44 ` cvs-commit at gcc dot gnu.org
2021-08-19 17:20 ` rearnsha 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).