From: Richard Guenther Date: Tue, 12 Dec 2006 12:13:48 +0000 (+0000) Subject: re PR middle-end/30147 (ICE in fold_convert with -O2) X-Git-Tag: releases/gcc-4.3.0~8009 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e3dc7a3449a516cacb71735055eb12fcebf5b6f;p=thirdparty%2Fgcc.git re PR middle-end/30147 (ICE in fold_convert with -O2) 2006-12-12 Richard Guenther 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 406b52b5cc41..61f49fa745b2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-12-12 Richard Guenther + + PR middle-end/30147 + * fold-const.c (fold_read_from_constant_string): Only fold read + from constant string if the result type is integer. + 2006-12-12 Olivier Hainque * config/rs6000/t-vxworks: Remove assignment to LIB2FUNCS_EXTRA. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 0908e2840f2f..f1f9c0022618 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2846aaf00110..8e8c438739ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-12-12 Richard Guenther + + PR middle-end/30147 + * gfortran.fortran-torture/compile/pr30147.f90: New testcase. + 2006-12-11 Aldy Hernandez Diego Novillo diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90 new file mode 100644 index 000000000000..b9c1533d5d22 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr30147.f90 @@ -0,0 +1,14 @@ +MODULE input_cp2k_motion + IMPLICIT NONE + interface + SUBROUTINE keyword_create(variants) + CHARACTER(len=*), DIMENSION(:), & + INTENT(in) :: variants + end subroutine + end interface +CONTAINS + SUBROUTINE create_neb_section() + CALL keyword_create(variants=(/"K"/)) + END SUBROUTINE create_neb_section +END MODULE input_cp2k_motion +