diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-12 12:13:48 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-12 12:13:48 +0000 |
commit | dd8249011bbe1acbbb5cc14c4cb530becf3f16bf (patch) | |
tree | eef02827a46ae7abdabd3134fa48f4b80f1b23ea /gcc/fold-const.c | |
parent | 7086c80a16af00517c801ed6e330472f748467a6 (diff) | |
download | gcc-dd8249011bbe1acbbb5cc14c4cb530becf3f16bf.tar.gz |
2006-12-12 Richard Guenther <rguenther@suse.de>
PR middle-end/30147
* fold-const.c (fold_read_from_constant_string): Only fold read
from constant string if the result type is integer.
* gfortran.fortran-torture/compile/pr30147.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119776 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 0908e2840f2..f1f9c002261 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -12726,7 +12726,9 @@ fold_unary_to_constant (enum tree_code code, tree type, tree op0) tree fold_read_from_constant_string (tree exp) { - if (TREE_CODE (exp) == INDIRECT_REF || TREE_CODE (exp) == ARRAY_REF) + if ((TREE_CODE (exp) == INDIRECT_REF + || TREE_CODE (exp) == ARRAY_REF) + && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE) { tree exp1 = TREE_OPERAND (exp, 0); tree index; |