aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-04-03 09:57:07 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-04-03 09:57:07 +0100
commitcaecd24e230c4727c88ad117bab0342f378e81f7 (patch)
tree752b4edaf218f54e9aac7726774ca581fb432b4c /gcc/testsuite/gcc.target
parent44ca5bc6800987e56db3e5537079b10ad5faac88 (diff)
downloadgcc-caecd24e230c4727c88ad117bab0342f378e81f7.zip
gcc-caecd24e230c4727c88ad117bab0342f378e81f7.tar.gz
gcc-caecd24e230c4727c88ad117bab0342f378e81f7.tar.bz2
Avoid creating (const (reg ...)) [PR108603]
convert_memory_address_addr_space_1 has two modes: one in which it tries to create a self-contained RTL expression (which might fail) and one in which it can emit new instructions where necessary. When handling a CONST, the function recurses into the CONST's operand and then constifies the result. But that's only valid if the result is still a self-contained expression. If new instructions have been emitted, the expression will refer to the (non-constant) results of those instructions. In the PR, this caused us to emit a nonsensical (const (reg ...)) REG_EQUAL note. gcc/ PR tree-optimization/108603 * explow.cc (convert_memory_address_addr_space_1): Only wrap the result of a recursive call in a CONST if no instructions were emitted. gcc/testsuite/ PR tree-optimization/108603 * gcc.target/aarch64/sve/pr108603.c: New test. (cherry picked from commit b09dc74801cf4e19bdf5fcd18a5cd53fc9e9ca9a)
Diffstat (limited to 'gcc/testsuite/gcc.target')
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr108603.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr108603.c b/gcc/testsuite/gcc.target/aarch64/sve/pr108603.c
new file mode 100644
index 0000000..a2aea9f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr108603.c
@@ -0,0 +1,8 @@
+/* { dg-options "-O2 -mabi=ilp32 -fdata-sections" } */
+
+int a[128];
+long long *p;
+void f() {
+ for (long i = 0; i < sizeof(long); i++)
+ p[i] = a[i];
+}