diff options
author | Jan Hubicka <jh@suse.cz> | 2010-09-09 17:07:21 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-09-09 15:07:21 +0000 |
commit | 54e34c358acefd04573881cb5db372423c1e8e9d (patch) | |
tree | 26599e9e8b44b5ab012025bf37371c093d0ec20f /gcc | |
parent | ba885ec559ca39e0dc23641dbbe67cc0072378f3 (diff) | |
download | gcc-54e34c358acefd04573881cb5db372423c1e8e9d.zip gcc-54e34c358acefd04573881cb5db372423c1e8e9d.tar.gz gcc-54e34c358acefd04573881cb5db372423c1e8e9d.tar.bz2 |
tree-ssa-ccp.c (fold_const_aggregate_ref): Check that result of string folding is of integral type.
* tree-ssa-ccp.c (fold_const_aggregate_ref): Check that result of
string folding is of integral type.
* fortran.fortran-torture/compile/pr45598.f90: New test.
From-SVN: r164111
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/compile/pr45598.f90 | 13 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 7 |
4 files changed, 28 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8bce53..3b1225a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-09-09 Jan Hubicka <jh@suse.cz> + + PR tree-optimization/45598 + * tree-ssa-ccp.c (fold_const_aggregate_ref): Check that result of + string folding is of integral type. + 2010-09-09 Nathan Sidwell <nathan@codesourcery.com> * configure.ac (gnu_indirect_function): New test. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c252a1f..2f0acf7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-09-08 Jan Hubicka <jh@suse.cz> + + PR tree-optimization/45598 + * fortran.fortran-torture/compile/pr45598.f90: New test. + 2010-09-09 Nathan Sidwell <nathan@codesourcery.com> * lib/target-supports-dg.exp (dg-require-ifunc): New. diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr45598.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr45598.f90 new file mode 100644 index 0000000..b8a883e --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr45598.f90 @@ -0,0 +1,13 @@ +program main +implicit none +character(len=10) :: digit_string = '123456789' +character :: digit_arr(10) +call copy(digit_string, digit_arr) +print '(1x, a1)',digit_arr(1:9) +contains + subroutine copy(in, out) + character, dimension(10) :: in, out + out(1:10) = in(1:10) + end subroutine copy +end program main + diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 7341477..60e2b55 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1398,8 +1398,7 @@ fold_const_aggregate_ref (tree t) } /* Fold read from constant string. */ - if (TREE_CODE (ctor) == STRING_CST - && TREE_CODE (idx) == INTEGER_CST) + if (TREE_CODE (ctor) == STRING_CST) { tree low_bound = array_ref_low_bound (t); double_int low_bound_cst; @@ -1407,7 +1406,9 @@ fold_const_aggregate_ref (tree t) double_int length_cst; bool signed_p = TYPE_UNSIGNED (TREE_TYPE (idx)); - if (TREE_CODE (low_bound) != INTEGER_CST) + if (TREE_CODE (idx) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (t)) + || TREE_CODE (low_bound) != INTEGER_CST) return NULL_TREE; low_bound_cst = tree_to_double_int (low_bound); index_cst = tree_to_double_int (idx); |