public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108691] New: ICE when compiling for AArch64 with BTI protection at -O1
@ 2023-02-07 10:04 david.spickett at linaro dot org
  2023-02-07 10:06 ` [Bug c/108691] " david.spickett at linaro dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: david.spickett at linaro dot org @ 2023-02-07 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108691
           Summary: ICE when compiling for AArch64 with BTI protection at
                    -O1
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.spickett at linaro dot org
  Target Milestone: ---

Created attachment 54416
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54416&action=edit
Output from -freport-bug

This code:
```
extern int __attribute__((returns_twice)) setjmp(void*);

void bbb(void) {
  int (*fnptr)(void*) = setjmp;
  fnptr(0);
}
```
Causes an ICE when compiled with gcc trunk.
```
during GIMPLE pass: cddce
<source>: In function 'bbb':
<source>:6:1: internal compiler error: in eliminate_unnecessary_stmts, at
tree-ssa-dce.cc:1512
    6 | }
      | ^
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

https://godbolt.org/z/6dEMEbEG8

Compiling at -O0, or calling setjmp directly avoids the crash. There is no
crash with gcc 12.2.

Also calling setjmp directly after using the function pointer avoids the crash.
One thing that is happening here is that gcc is converting the indirect call
into a direct one. Perhaps when that is the only call in the function, that's
the problematic situation.

For context, this is not from real code. It's a clang test case for bti
protection of returns twice calls. Either way, the compiler shouldn't crash and
if there's something wrong with the source it should say so.

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

end of thread, other threads:[~2023-02-21 13:08 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 10:04 [Bug c/108691] New: ICE when compiling for AArch64 with BTI protection at -O1 david.spickett at linaro dot org
2023-02-07 10:06 ` [Bug c/108691] " david.spickett at linaro dot org
2023-02-07 10:16 ` [Bug tree-optimization/108691] ICE with function ptr and setjmp/returns twice " pinskia at gcc dot gnu.org
2023-02-07 10:17 ` [Bug tree-optimization/108691] [13 Regression] " pinskia at gcc dot gnu.org
2023-02-07 10:17 ` pinskia at gcc dot gnu.org
2023-02-07 10:21 ` pinskia at gcc dot gnu.org
2023-02-07 14:07 ` rguenth at gcc dot gnu.org
2023-02-13  9:34 ` rguenth at gcc dot gnu.org
2023-02-13  9:51 ` david.spickett at linaro dot org
2023-02-13 10:01 ` rguenth at gcc dot gnu.org
2023-02-13 14:57 ` cvs-commit at gcc dot gnu.org
2023-02-13 14:58 ` rguenth at gcc dot gnu.org
2023-02-15  8:19 ` david.spickett at linaro dot org
2023-02-21  9:27 ` rguenth at gcc dot gnu.org
2023-02-21  9:50 ` sam at gentoo dot org
2023-02-21  9:59 ` jakub at gcc dot gnu.org
2023-02-21 13:08 ` cvs-commit at gcc dot gnu.org
2023-02-21 13:08 ` rguenth 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).