diff options
author | Richard Guenther <rguenther@suse.de> | 2010-01-13 13:31:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-01-13 13:31:13 +0000 |
commit | 48f30f629fb6991ba1ddbd40385993a2a29457a8 (patch) | |
tree | 53f4a546ee8865499b7d85bcfaf0e4d567e56007 /gcc/fold-const.c | |
parent | 9e73c69087510db9321f4f6d91280519a643ff55 (diff) | |
download | gcc-48f30f629fb6991ba1ddbd40385993a2a29457a8.zip gcc-48f30f629fb6991ba1ddbd40385993a2a29457a8.tar.gz gcc-48f30f629fb6991ba1ddbd40385993a2a29457a8.tar.bz2 |
re PR middle-end/42716 (ICE in extract_range_from_assert, at tree-vrp.c:1423)
2010-01-13 Richard Guenther <rguenther@suse.de>
PR middle-end/42716
* fold-const.c (fold_unary_loc): Fold INDIRECT_REFs.
* gcc.c-torture/compile/pr42716.c: New testcase.
From-SVN: r155859
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e112621..9e40296 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8942,6 +8942,19 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) } return NULL_TREE; + case INDIRECT_REF: + /* Fold *&X to X if X is an lvalue. */ + if (TREE_CODE (op0) == ADDR_EXPR) + { + tree op00 = TREE_OPERAND (op0, 0); + if ((TREE_CODE (op00) == VAR_DECL + || TREE_CODE (op00) == PARM_DECL + || TREE_CODE (op00) == RESULT_DECL) + && !TREE_READONLY (op00)) + return op00; + } + return NULL_TREE; + default: return NULL_TREE; } /* switch (code) */ |