The PR showed us ICEing in build_poly_int_cst because we have type set
to a non-type tree node (a var_decl). A closer look shows this is
because we pass the wrong variable to wide_int_to_tree in
expmed.cc:make_tree: we pass t instead of type, where t is
uninitialized at the point of the call. Fixed thusly.
I also took the opportunity to move the CONST_POLY_INT case out of the
default: section into its own case of the switch.
gcc/ChangeLog:
PR middle-end/125621
* expmed.cc (make_tree): Fix CONST_POLY_INT case to pass type
instead of t, move it to its own switch case.
gcc/testsuite/ChangeLog:
PR middle-end/125621
* gcc.target/aarch64/torture/pr125621.c: New test.
t = wide_int_to_tree (type, rtx_mode_t (x, TYPE_MODE (type)));
return t;
+ case CONST_POLY_INT:
+ return wide_int_to_tree (type, const_poly_int_value (x));
+
case CONST_DOUBLE:
STATIC_ASSERT (HOST_BITS_PER_WIDE_INT * 2 <= MAX_BITSIZE_MODE_ANY_INT);
if (TARGET_SUPPORTS_WIDE_INT == 0 && GET_MODE (x) == VOIDmode)
/* fall through. */
default:
- if (CONST_POLY_INT_P (x))
- return wide_int_to_tree (t, const_poly_int_value (x));
-
t = build_decl (RTL_LOCATION (x), VAR_DECL, NULL_TREE, type);
/* If TYPE is a POINTER_TYPE, we might need to convert X from
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-march=armv8.2-a+sve -fsanitize=undefined" } */
+#include <arm_sve.h>
+
+long foo(long x) {
+ return (long)svcntd() * x;
+}