re PR middle-end/81737 (164.gzip in SPEC CPU 2000 failed to build)

PR middle-end/81737
	* fold-const.c (fold_indirect_ref_1): Check type_domain.

	* gcc.dg/pr81737.c: New test.

From-SVN: r250912
This commit is contained in:
Marek Polacek 2017-08-07 09:13:02 +00:00 committed by Marek Polacek
parent 577eec5656
commit 1653a86549
4 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2017-08-07 Marek Polacek <polacek@redhat.com>
PR middle-end/81737
* fold-const.c (fold_indirect_ref_1): Check type_domain.
2017-08-07 Martin Liska <mliska@suse.cz>
* attribs.h (canonicalize_attr_name): New function.

View file

@ -14107,8 +14107,10 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
&& type == TREE_TYPE (op00type))
{
tree type_domain = TYPE_DOMAIN (op00type);
tree min = TYPE_MIN_VALUE (type_domain);
if (min && TREE_CODE (min) == INTEGER_CST)
tree min;
if (type_domain != NULL_TREE
&& (min = TYPE_MIN_VALUE (type_domain))
&& TREE_CODE (min) == INTEGER_CST)
{
offset_int off = wi::to_offset (op01);
offset_int el_sz = wi::to_offset (TYPE_SIZE_UNIT (type));

View file

@ -1,3 +1,8 @@
2017-08-07 Marek Polacek <polacek@redhat.com>
PR middle-end/81737
* gcc.dg/pr81737.c: New test.
2017-08-07 Martin Liska <mliska@suse.cz>
* g++.dg/cpp0x/pr65558.C: Update scanned pattern.

View file

@ -0,0 +1,6 @@
/* PR middle-end/81737 */
/* { dg-do compile } */
/* { dg-options "" } */
extern int a[];
void fn1() { (a + 0)[1]; }