From: Marek Polacek Date: Mon, 7 Aug 2017 09:13:02 +0000 (+0000) Subject: re PR middle-end/81737 (164.gzip in SPEC CPU 2000 failed to build) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1653a8654977e0708b4669ed6637772cd47ac796;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 880a3c89a3f..8fbb8c4d8b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-08-07 Marek Polacek + + PR middle-end/81737 + * fold-const.c (fold_indirect_ref_1): Check type_domain. + 2017-08-07 Martin Liska * attribs.h (canonicalize_attr_name): New function. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index d563ba76766..8eaea6cce3a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e5f7050826..bf161a31141 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-07 Marek Polacek + + PR middle-end/81737 + * gcc.dg/pr81737.c: New test. + 2017-08-07 Martin Liska * g++.dg/cpp0x/pr65558.C: Update scanned pattern. diff --git a/gcc/testsuite/gcc.dg/pr81737.c b/gcc/testsuite/gcc.dg/pr81737.c new file mode 100644 index 00000000000..493358956ef --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81737.c @@ -0,0 +1,6 @@ +/* PR middle-end/81737 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern int a[]; +void fn1() { (a + 0)[1]; }