Run-of-the-mill checking issue. We had something like (plus (reg) (reg)) and
tried to extract INTVAL (XEXP (x, 1)) which of course blows up with checking
on.
Fixed thusly. Tested on riscv32-elf in my tester. riscv64-elf is in flight,
but won't finish for a while due to other tasks in flight.
PR target/114139
gcc/
* config/riscv/riscv.cc (riscv_macro_fusion_pair_p): Verify object
is a CONST_INT before looking at INTVAL.
gcc/testsuite/
* gcc.target/riscv/pr114139.c: New test.
&& XINT (SET_SRC (prev_set), 1) == UNSPEC_AUIPC
&& (GET_CODE (SET_SRC (curr_set)) == LO_SUM
|| (GET_CODE (SET_SRC (curr_set)) == PLUS
+ && CONST_INT_P (XEXP (SET_SRC (curr_set), 1))
&& SMALL_OPERAND (INTVAL (XEXP (SET_SRC (curr_set), 1))))))
return true;
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic -mexplicit-relocs -mcpu=sifive-p450" } */
+
+static void *p;
+extern void *a[];
+void
+baz (void)
+{
+ p = 0;
+}
+
+void bar (void);
+void
+foo (int i)
+{
+ bar ();
+ a[i] = p;
+}
+
+
+double *d;
+void
+foobar (int i)
+{
+ for (; i; ++i)
+ d[i] = 1;
+}