diff options
author | Richard Guenther <rguenther@suse.de> | 2005-11-19 21:40:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2005-11-19 21:40:28 +0000 |
commit | 41b9109a5565194e18132b8949b1952feab6557a (patch) | |
tree | 86cca737b2d981739302836702a628969d5411f1 /gcc/fold-const.c | |
parent | 815d8045e0779059e39afdcd9cf372412287a5b9 (diff) | |
download | gcc-41b9109a5565194e18132b8949b1952feab6557a.zip gcc-41b9109a5565194e18132b8949b1952feab6557a.tar.gz gcc-41b9109a5565194e18132b8949b1952feab6557a.tar.bz2 |
fold-const.c (fold_indirect_ref_1): Make sure we fold ARRAY_REFs of constant strings.
2005-11-19 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_indirect_ref_1): Make sure we fold
ARRAY_REFs of constant strings.
From-SVN: r107229
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b8576fc..c4dd4f9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11523,9 +11523,15 @@ fold_indirect_ref_1 (tree type, tree op0) { tree op = TREE_OPERAND (sub, 0); tree optype = TREE_TYPE (op); - /* *&p => p */ + /* *&p => p; make sure to handle *&"str"[cst] here. */ if (type == optype) - return op; + { + tree fop = fold_read_from_constant_string (op); + if (fop) + return fop; + else + return op; + } /* *(foo *)&fooarray => fooarray[0] */ else if (TREE_CODE (optype) == ARRAY_TYPE && type == TREE_TYPE (optype)) |