aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-09-10 14:44:20 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-09-10 07:44:20 -0700
commit90966337970092f84e1029aa27376922fb24943c (patch)
tree05617c079ccaa413d47387ff2560d6ff0312a40c /gcc/tree-ssa-ccp.c
parente1d9659dd302e125682c6ed7d5c613c7a1cbefdc (diff)
downloadgcc-90966337970092f84e1029aa27376922fb24943c.zip
gcc-90966337970092f84e1029aa27376922fb24943c.tar.gz
gcc-90966337970092f84e1029aa27376922fb24943c.tar.bz2
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
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c5
1 files changed, 3 insertions, 2 deletions
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