diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-12-04 09:01:09 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-12-04 09:01:09 +0100 |
commit | 4586d7d0a92e9b60d0c01043e0ae262b1e06f337 (patch) | |
tree | 96e4ff9798132786f5f7254f3811ee16ceda04af /gcc | |
parent | 994d6dc64435d6b7c50accca9941ee7decd92a22 (diff) | |
download | gcc-4586d7d0a92e9b60d0c01043e0ae262b1e06f337.zip gcc-4586d7d0a92e9b60d0c01043e0ae262b1e06f337.tar.gz gcc-4586d7d0a92e9b60d0c01043e0ae262b1e06f337.tar.bz2 |
i386: Fix rtl checking ICE in ix86_elim_entry_set_got [PR112837]
The following testcase ICEs with RTL checking, because it sets if
XINT (SET_SRC (set), 1) is UNSPEC_SET_GOT without checking if SET_SRC (set)
is actually an UNSPEC, so any time we see any other insn with PARALLEL
and a SET in it which is not an UNSPEC we ICE during RTL checking or
access there some other union member as if it was an rt_int.
The rest is just small cleanup.
2023-12-04 Jakub Jelinek <jakub@redhat.com>
PR target/112837
* config/i386/i386.cc (ix86_elim_entry_set_got): Before checking
for UNSPEC_SET_GOT check that SET_SRC is UNSPEC. Use SET_SRC and
SET_DEST macros instead of XEXP, rename vec variable to set.
* gcc.dg/pr112837.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/i386/i386.cc | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr112837.c | 11 |
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 0f91ee7..93a9cb5 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -8607,10 +8607,11 @@ ix86_elim_entry_set_got (rtx reg) rtx pat = PATTERN (c_insn); if (GET_CODE (pat) == PARALLEL) { - rtx vec = XVECEXP (pat, 0, 0); - if (GET_CODE (vec) == SET - && XINT (XEXP (vec, 1), 1) == UNSPEC_SET_GOT - && REGNO (XEXP (vec, 0)) == REGNO (reg)) + rtx set = XVECEXP (pat, 0, 0); + if (GET_CODE (set) == SET + && GET_CODE (SET_SRC (set)) == UNSPEC + && XINT (SET_SRC (set), 1) == UNSPEC_SET_GOT + && REGNO (SET_DEST (set)) == REGNO (reg)) delete_insn (c_insn); } } diff --git a/gcc/testsuite/gcc.dg/pr112837.c b/gcc/testsuite/gcc.dg/pr112837.c new file mode 100644 index 0000000..2de43f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr112837.c @@ -0,0 +1,11 @@ +/* PR target/112837 */ +/* { dg-do compile } */ +/* { dg-options "-fcompare-elim -fprofile" } */ +/* { dg-additional-options "-fpie" { target pie } } */ +/* { dg-require-profiling "-fprofile" } */ + +void +foo (int i) +{ + foo (i); +} |