public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
@ 2023-11-01 13:18 fkastl at suse dot cz
  2023-11-02 13:03 ` [Bug target/112334] " rearnsha at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fkastl at suse dot cz @ 2023-11-01 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112334
           Summary: ICE in gen_untyped_return arm.md:9197 while compiling
                    harden-cfr-bret.c
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fkastl at suse dot cz
  Target Milestone: ---
              Host: x86_64-linux
            Target: arm-linux-gnueabi

Compiling the harden-cfr-bret-never.c  file from testsuite

arm-linux-gnueabi-gcc testsuite/c-c++-common/torture/harden-cfr-bret-never.c
-mflip-thumb

results in an ICE

during RTL pass: expand
In file included from
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/c-c++-common/torture/harden-cfr-bret-never.c:8:
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/c-c++-common/torture/harden-cfr-bret.c:
In function ‘g’:
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/c-c++-common/torture/harden-cfr-bret.c:11:3:
internal compiler error: Segmentation fault
   11 |   __builtin_return (&i);
      |   ^~~~~~~~~~~~~~~~~~~~~
0xc7585f crash_signal
        /home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/toplev.cc:315
0x132d068 gen_untyped_return(rtx_def*, rtx_def*)
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/config/arm/arm.md:9197
0xfa6e85 target_gen_untyped_return
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/config/arm/arm.md:9140
0x7c6053 expand_builtin_return
        /home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/builtins.cc:1805
0x7d7acc expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        /home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/builtins.cc:7550
0x8f673d expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/expr.cc:11932
0x7f41e6 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
        /home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/expr.h:310
0x7f41e6 expand_call_stmt
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/cfgexpand.cc:2831
0x7f41e6 expand_gimple_stmt_1
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/cfgexpand.cc:3880
0x7f41e6 expand_gimple_stmt
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/cfgexpand.cc:4044
0x7f8e07 expand_gimple_basic_block
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/cfgexpand.cc:6100
0x7fab0e execute
       
/home/worker/buildworker/tiber-gcc-trunk-arm/build/gcc/cfgexpand.cc:6835

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

* [Bug target/112334] ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
  2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
@ 2023-11-02 13:03 ` rearnsha at gcc dot gnu.org
  2023-12-01 17:38 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2023-11-02 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
This might be a side issue, but:

@defbuiltin{{void} __builtin_return (void *@var{result})}
This built-in function returns the value described by @var{result} from
the containing function.  You should specify, for @var{result}, a value
returned by @code{__builtin_apply}.

So I'm not sure it's legal to pass &i to __builtin_return().

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

* [Bug target/112334] ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
  2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
  2023-11-02 13:03 ` [Bug target/112334] " rearnsha at gcc dot gnu.org
@ 2023-12-01 17:38 ` cvs-commit at gcc dot gnu.org
  2023-12-06 21:47 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-01 17:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:b8edb812ff4934c609fdfafe2e1c7f932bc18305

commit r14-6062-gb8edb812ff4934c609fdfafe2e1c7f932bc18305
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Dec 1 14:31:22 2023 -0300

    hardcfr: make builtin_return tests more portable [PR112334]

    Rework __builtin_return tests to explicitly call __builtin_apply and
    use its return value rather than anything else.  Also require
    untyped_assembly.  Avoid the noise out of exceptions escaping the
    builtin-applied function, but add a test to cover their effects as
    well.


    for  gcc/testsuite/ChangeLog

            PR target/112334
            * c-c++-common/torture/harden-cfr-bret.c: Rework for stricter
            untyped_return requirements.  Require untyped_assembly.
            * c-c++-common/torture/harden-cfr-bret-except.c: New.
            * c-c++-common/torture/harden-cfr-bret-always.c: Require
            untyped_assembly.
            * c-c++-common/torture/harden-cfr-bret-never.c: Likewise.
            * c-c++-common/torture/harden-cfr-bret-noopt.c: Likewise.
            * c-c++-common/torture/harden-cfr-bret-noret.c: Likewise.
            * c-c++-common/torture/harden-cfr-bret-no-xthrow.c: Likewise.
            * c-c++-common/torture/harden-cfr-bret-nothrow.c: Likewise.
            * c-c++-common/torture/harden-cfr-bret-retcl.c: Likewise.

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

* [Bug target/112334] ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
  2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
  2023-11-02 13:03 ` [Bug target/112334] " rearnsha at gcc dot gnu.org
  2023-12-01 17:38 ` cvs-commit at gcc dot gnu.org
@ 2023-12-06 21:47 ` aoliva at gcc dot gnu.org
  2023-12-12  4:16 ` cvs-commit at gcc dot gnu.org
  2023-12-12  4:46 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-06 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |aoliva at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-12-06
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #3 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
The testcase changes silenced the noise that made the problem visible, but the
latent bug is still lurking.

The patch that cures the underlying bug is at
https://gcc.gnu.org/pipermail/gcc-patches/2023-December/638949.html

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

* [Bug target/112334] ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
  2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
                   ` (2 preceding siblings ...)
  2023-12-06 21:47 ` aoliva at gcc dot gnu.org
@ 2023-12-12  4:16 ` cvs-commit at gcc dot gnu.org
  2023-12-12  4:46 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-12  4:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:d96533559e26dd0c86f0708fa46eef65c35f7b90

commit r14-6446-gd96533559e26dd0c86f0708fa46eef65c35f7b90
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Tue Dec 12 01:12:04 2023 -0300

    untyped calls: enable target switching [PR112334]

    The computation of apply_args_size and apply_result_size is saved in a
    static variable, so that the corresponding _mode arrays are
    initialized only once.  That is not compatible with switchable
    targets, and ARM's arm_set_current_function, by saving and restoring
    target globals, exercises this problem with a testcase such as that in
    the PR, in which more than one function in the translation unit calls
    __builtin_apply or __builtin_return, respectively.

    This patch moves the _size statics into the target_builtins array,
    with a bit of ugliness over _plus_one so that zero initialization of
    the struct does the right thing.


    for  gcc/ChangeLog

            PR target/112334
            * builtins.h (target_builtins): Add fields for apply_args_size
            and apply_result_size.
            * builtins.cc (apply_args_size, apply_result_size): Cache
            results in fields rather than in static variables.
            (get_apply_args_size, set_apply_args_size): New.
            (get_apply_result_size, set_apply_result_size): New.

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

* [Bug target/112334] ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c
  2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
                   ` (3 preceding siblings ...)
  2023-12-12  4:16 ` cvs-commit at gcc dot gnu.org
@ 2023-12-12  4:46 ` aoliva at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-12  4:46 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed, though there's an (optional) followup, posted along with the fix, that's
not clearly approved.

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

end of thread, other threads:[~2023-12-12  4:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 13:18 [Bug target/112334] New: ICE in gen_untyped_return arm.md:9197 while compiling harden-cfr-bret.c fkastl at suse dot cz
2023-11-02 13:03 ` [Bug target/112334] " rearnsha at gcc dot gnu.org
2023-12-01 17:38 ` cvs-commit at gcc dot gnu.org
2023-12-06 21:47 ` aoliva at gcc dot gnu.org
2023-12-12  4:16 ` cvs-commit at gcc dot gnu.org
2023-12-12  4:46 ` aoliva 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).