aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-08-07 09:13:02 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-08-07 09:13:02 +0000
commit1653a8654977e0708b4669ed6637772cd47ac796 (patch)
treec72da11b6870d2b9434b964c2d09e75e1b667b99 /gcc/fold-const.c
parent577eec5656925889d99c658de2a54ba8bd3ebf79 (diff)
downloadgcc-1653a8654977e0708b4669ed6637772cd47ac796.zip
gcc-1653a8654977e0708b4669ed6637772cd47ac796.tar.gz
gcc-1653a8654977e0708b4669ed6637772cd47ac796.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d563ba7..8eaea6c 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));