diff options
author | Richard Guenther <rguenther@suse.de> | 2006-12-12 12:13:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-12-12 12:13:48 +0000 |
commit | 8e3dc7a3449a516cacb71735055eb12fcebf5b6f (patch) | |
tree | eef02827a46ae7abdabd3134fa48f4b80f1b23ea /gcc/fold-const.c | |
parent | 527a08917e8c4310c129c42649991f51b2f5c1a9 (diff) | |
download | gcc-8e3dc7a3449a516cacb71735055eb12fcebf5b6f.zip gcc-8e3dc7a3449a516cacb71735055eb12fcebf5b6f.tar.gz gcc-8e3dc7a3449a516cacb71735055eb12fcebf5b6f.tar.bz2 |
re PR middle-end/30147 (ICE in fold_convert with -O2)
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.
From-SVN: r119776
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 0908e28..f1f9c00 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; |