Commit 587240d2 by Richard Biener Committed by Richard Biener

re PR c/79731 (ICE: verify_gimple failed)

2017-02-28  Richard Biener  <rguenther@suse.de>

	PR middle-end/79731
	* fold-const.c (decode_field_reference): Reject out-of-bound
	accesses.

	* c-c++-common/torture/pr79731.c: New testcase.

From-SVN: r245779
parent 324ff1a0
2017-02-28 Richard Biener <rguenther@suse.de>
PR middle-end/79731
* fold-const.c (decode_field_reference): Reject out-of-bound
accesses.
2017-02-28 Jakub Jelinek <jakub@redhat.com> 2017-02-28 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c: Include intl.h. * config/i386/i386.c: Include intl.h.
......
...@@ -4133,7 +4133,11 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize, ...@@ -4133,7 +4133,11 @@ decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
punsignedp, preversep, pvolatilep); punsignedp, preversep, pvolatilep);
if ((inner == exp && and_mask == 0) if ((inner == exp && and_mask == 0)
|| *pbitsize < 0 || offset != 0 || *pbitsize < 0 || offset != 0
|| TREE_CODE (inner) == PLACEHOLDER_EXPR) || TREE_CODE (inner) == PLACEHOLDER_EXPR
/* Reject out-of-bound accesses (PR79731). */
|| (! AGGREGATE_TYPE_P (TREE_TYPE (inner))
&& compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)),
*pbitpos + *pbitsize) < 0))
return 0; return 0;
*exp_ = exp; *exp_ = exp;
......
2017-02-28 Richard Biener <rguenther@suse.de> 2017-02-28 Richard Biener <rguenther@suse.de>
PR middle-end/79731
* c-c++-common/torture/pr79731.c: New testcase.
2017-02-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79732 PR tree-optimization/79732
* gcc.dg/torture/pr79732.c: New testcase. * gcc.dg/torture/pr79732.c: New testcase.
......
/* { dg-do compile } */
/* { dg-additional-options "-Wno-psabi -w" } */
typedef unsigned V __attribute__ ((vector_size (8)));
V
foo (unsigned x, V v)
{
do {
v %= x;
x = 1;
} while (v[1]);
return v;
}
void fn2 ()
{
V x = foo (5, (V) { 0, 1 });
if (x[0] || x[1] || x[2] || x[3]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment