public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-6347] [PR112875][LRA]: Fix an assert in lra elimination code
@ 2023-12-08 20:52 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2023-12-08 20:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:48cb51827c9eb991b92014a3f59d31eb237ce03f

commit r14-6347-g48cb51827c9eb991b92014a3f59d31eb237ce03f
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Fri Dec 8 15:37:42 2023 -0500

    [PR112875][LRA]: Fix an assert in lra elimination code
    
    PR112875 test ran into a wrong assert (gcc_unreachable) in elimination
    in a debug insn.  The insn seems ok.  So I change the assertion.
    To be more accurate I made it the same as analogous reload pass code.
    
    gcc/ChangeLog:
    
            PR rtl-optimization/112875
            * lra-eliminations.cc (lra_eliminate_regs_1): Change an assert.
            Add ASM_OPERANDS case.
    
    gcc/testsuite/ChangeLog:
    
            PR rtl-optimization/112875
            * gcc.target/i386/pr112875.c: New test.

Diff:
---
 gcc/lra-eliminations.cc                  |  4 ++++
 gcc/testsuite/gcc.target/i386/pr112875.c | 33 ++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc
index f3b75e08390..cf229b402da 100644
--- a/gcc/lra-eliminations.cc
+++ b/gcc/lra-eliminations.cc
@@ -666,6 +666,10 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
       return x;
 
     case CLOBBER:
+    case ASM_OPERANDS:
+      gcc_assert (insn && DEBUG_INSN_P (insn));
+      break;
+
     case SET:
       gcc_unreachable ();
 
diff --git a/gcc/testsuite/gcc.target/i386/pr112875.c b/gcc/testsuite/gcc.target/i386/pr112875.c
new file mode 100644
index 00000000000..b704404b248
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr112875.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Oz -frounding-math -fno-dce -fno-trapping-math -fno-tree-dce -fno-tree-dse -g" } */
+long a, f;
+int b, c, d, g, h, i, j;
+char e;
+void k(long, int l, char t) {
+  char m = b, n = g, o = 0;
+  int p, q, r = h;
+  long s = g;
+  if (f) {
+    q = t + (float)16777217;
+    o = ~0;
+  }
+  if (e) {
+    d = g + a;
+    if (d % (a % l)) {
+      p = d;
+      n = b;
+    }
+    if (l) {
+      i = b;
+      r = a;
+      p = h;
+    }
+    if (s)
+      s = q;
+    c = f;
+    e += t;
+    a = p;
+  }
+  j = r % n;
+  s += g / 0xc000000000000000 + !o;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-08 20:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-08 20:52 [gcc r14-6347] [PR112875][LRA]: Fix an assert in lra elimination code Vladimir Makarov

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).