Check that result of string folding is of integral type.

gcc/

2010-09-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/45634
	* tree-ssa-ccp.c (fold_const_aggregate_ref): Check that result
	of string folding is of integral type.

gcc/testsuite/

2010-09-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/45634
	* gfortran.fortran-torture/compile/pr45634.f90: New.

From-SVN: r164183
This commit is contained in:
H.J. Lu 2010-09-10 14:44:20 +00:00 committed by H.J. Lu
parent e1d9659dd3
commit 9096633797
4 changed files with 19 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-09-10 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/45634
* tree-ssa-ccp.c (fold_const_aggregate_ref): Check that result
of string folding is of integral type.
2010-09-10 Ryan Mansfield <rmansfield@qnx.com>
* doc/invoke.texi (-x): Fix typo.

View File

@ -1,3 +1,8 @@
2010-09-10 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/45634
* gfortran.fortran-torture/compile/pr45634.f90: New.
2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/fobjc-exceptions.m: New test.

View File

@ -0,0 +1,5 @@
SUBROUTINE RCRDRD (VTYP)
CHARACTER(4), INTENT(OUT) :: VTYP
CHARACTER(1), SAVE :: DBL = "D"
VTYP = DBL
END

View File

@ -1537,8 +1537,9 @@ fold_const_aggregate_ref (tree t)
/* Fold read from constant string. */
if (TREE_CODE (ctor) == STRING_CST)
{
if ((TYPE_MODE (TREE_TYPE (t))
== TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
if (INTEGRAL_TYPE_P (TREE_TYPE (t))
&& (TYPE_MODE (TREE_TYPE (t))
== TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
&& (GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor))))
== MODE_INT)
&& GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (ctor)))) == 1