summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>2018-01-08 18:42:50 +0000
committerktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>2018-01-08 18:42:50 +0000
commit104e5f3e3f9e8858bbf19c8f7ac730af09906f4f (patch)
treeb0577ae862fcd32d16870ebfd8abb8a565e039fe
parent4b4bc4aad1b41c818ccad1bdebba22e26404d72e (diff)
downloadgcc-104e5f3e3f9e8858bbf19c8f7ac730af09906f4f.tar.gz
[arm] PR target/82975: Guard against reg_renumber being NULL in arm.h
Backport from mainline 2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> PR target/82975 * config/arm/arm.h (TEST_REGNO): Adjust comment as expected in r255830. * gcc.dg/pr82975.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256350 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/arm/arm.h8
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/pr82975.c20
4 files changed, 39 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5ab8bc9a10..02a444da0cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * config/arm/arm.h (TEST_REGNO): Adjust comment as expected in r255830.
+
2018-01-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
Backported from mainline
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 275004af938..25953f53bd6 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1662,12 +1662,10 @@ enum arm_auto_incmodes
/* These assume that REGNO is a hard or pseudo reg number.
They give nonzero only if REGNO is a hard reg of the suitable class
- or a pseudo reg currently allocated to a suitable hard reg.
- Since they use reg_renumber, they are safe only once reg_renumber
- has been allocated, which happens in reginfo.c during register
- allocation. */
+ or a pseudo reg currently allocated to a suitable hard reg. */
#define TEST_REGNO(R, TEST, VALUE) \
- ((R TEST VALUE) || ((unsigned) reg_renumber[R] TEST VALUE))
+ ((R TEST VALUE) \
+ || (reg_renumber && ((unsigned) reg_renumber[R] TEST VALUE)))
/* Don't allow the pc to be used. */
#define ARM_REGNO_OK_FOR_BASE_P(REGNO) \
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c6c7916ae39..27e93371701 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-08 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ Backport from mainline
+ 2017-12-19 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/82975
+ * gcc.dg/pr82975.c: New test.
+
2018-01-04 Uros Bizjak <ubizjak@gmail.com>
PR target/83628
diff --git a/gcc/testsuite/gcc.dg/pr82975.c b/gcc/testsuite/gcc.dg/pr82975.c
new file mode 100644
index 00000000000..422ba6c6855
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr82975.c
@@ -0,0 +1,20 @@
+/* PR target/82975. */
+/* { dg-do compile } */
+/* { dg-options "-fno-sched-pressure -O2" } */
+/* { dg-additional-options "-mtune=cortex-a57" { target arm*-*-* aarch64*-*-* } } */
+
+typedef __SIZE_TYPE__ size_t;
+
+struct S1
+{
+ char pad1;
+ char val;
+ short pad2;
+};
+
+extern char t[256];
+
+void foo (struct S1 a, size_t i)
+{
+ t[i] = a.val;
+}