[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
This commit is contained in:
Kyrylo Tkachov 2016-06-02 12:26:42 +00:00 committed by Kyrylo Tkachov
parent 8aa5bdd61e
commit b5bd197890
4 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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,

View File

@ -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.

View File

@ -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]);
}