This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR middle-end/45634: [4.6 regression] Revision 163973 faild to compile 191.fma3d in SPEC CPU 2K
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 10 Sep 2010 07:38:12 -0700
- Subject: PATCH: PR middle-end/45634: [4.6 regression] Revision 163973 faild to compile 191.fma3d in SPEC CPU 2K
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
Here is a patch to check result of string folding is of integral type.
OK for trunk?
Thanks.
H.J.
---
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.
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 60e2b55..33d5cc7 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -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
--- /dev/null 2010-09-09 09:16:30.485584932 -0700
+++ gcc/gcc/testsuite/gfortran.fortran-torture/compile/pr45634.f90 2010-09-10 07:32:31.188022445 -0700
@@ -0,0 +1,5 @@
+ SUBROUTINE RCRDRD (VTYP)
+ CHARACTER(4), INTENT(OUT) :: VTYP
+ CHARACTER(1), SAVE :: DBL = "D"
+ VTYP = DBL
+ END