aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2016-06-02 12:26:42 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2016-06-02 12:26:42 +0000
commitb5bd197890a8394028e77e0345cf8c326bfc419f (patch)
treea941aa68273c5d9bb083a41f678ef943244940f1 /gcc
parent8aa5bdd61e96a7adeec6dad22847be27faad7122 (diff)
downloadgcc-b5bd197890a8394028e77e0345cf8c326bfc419f.zip
gcc-b5bd197890a8394028e77e0345cf8c326bfc419f.tar.gz
gcc-b5bd197890a8394028e77e0345cf8c326bfc419f.tar.bz2
[rtlanal] Fix rtl-optimization/71295
PR rtl-optimization/71295 * rtlanal.c (subreg_get_info): If taking a subreg at the requested offset would go over the size of the inner mode reject it. * gcc.c-torture/compile/pr71295.c: New test. From-SVN: r237034
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/rtlanal.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr71295.c12
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6c983ac..01beb95 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR rtl-optimization/71295
+ * rtlanal.c (subreg_get_info): If taking a subreg at the requested
+ offset would go over the size of the inner mode reject it.
+
2016-06-02 Jakub Jelinek <jakub@redhat.com>
* config/i386/sse.md (*vec_concatv4si): Use v=v,v instead of
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 0b6e1e0..8e4762c 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -3657,6 +3657,16 @@ subreg_get_info (unsigned int xregno, machine_mode xmode,
info->offset = offset / regsize_xmode;
return;
}
+ /* It's not valid to extract a subreg of mode YMODE at OFFSET that
+ would go outside of XMODE. */
+ if (!rknown
+ && GET_MODE_SIZE (ymode) + offset > GET_MODE_SIZE (xmode))
+ {
+ info->representable_p = false;
+ info->nregs = nregs_ymode;
+ info->offset = offset / regsize_xmode;
+ return;
+ }
/* Quick exit for the simple and common case of extracting whole
subregisters from a multiregister value. */
/* ??? It would be better to integrate this into the code below,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c4b2f25..2bd4681 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-02 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR rtl-optimization/71295
+ * gcc.c-torture/compile/pr71295.c: New test.
+
2016-06-02 Jakub Jelinek <jakub@redhat.com>
* gcc.target/i386/avx512vl-concatv4si-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71295.c b/gcc/testsuite/gcc.c-torture/compile/pr71295.c
new file mode 100644
index 0000000..d2ec852
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr71295.c
@@ -0,0 +1,12 @@
+extern void fn2 (long long);
+int a;
+
+void
+fn1 ()
+{
+ long long b[3];
+ a = 0;
+ for (; a < 3; a++)
+ b[a] = 1;
+ fn2 (b[1]);
+}