public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "david.spickett at linaro dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/108691] New: ICE when compiling for AArch64 with BTI protection at -O1
Date: Tue, 07 Feb 2023 10:04:44 +0000	[thread overview]
Message-ID: <bug-108691-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-02-07 10:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 10:04 david.spickett at linaro dot org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108691-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).