aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
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/rtlanal.c
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/rtlanal.c')
-rw-r--r--gcc/rtlanal.c10
1 files changed, 10 insertions, 0 deletions
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,