string folding is of integral type.
* fortran.fortran-torture/compile/pr45598.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164111
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
+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.
--- /dev/null
+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
+
}
/* 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;
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);