summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-24 09:08:45 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-24 09:08:45 +0000
commitf982ec99481f34905deb32c8c5fb70a67a241f8a (patch)
treea4f0295eb7ee3be44054ba1e4ed8760a40410884 /gcc/tree-ssa-sccvn.c
parenta4f25704ac8b4a40007b85671d012cef0f345e53 (diff)
downloadgcc-f982ec99481f34905deb32c8c5fb70a67a241f8a.tar.gz
gcc/ChangeLog
PR tree-ssa/57385 * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Check that index is not negative. gcc/testsuite/ChangeLog PR tree-ssa/57385 * gcc.dg/tree-ssa/pr57385.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199282 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 49d61b0c239..0e7a74c2a9c 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1294,6 +1294,7 @@ fully_constant_vn_reference_p (vn_reference_t ref)
== TYPE_MODE (TREE_TYPE (TREE_TYPE (arg0->op0))))
&& GET_MODE_CLASS (TYPE_MODE (op->type)) == MODE_INT
&& GET_MODE_SIZE (TYPE_MODE (op->type)) == 1
+ && tree_int_cst_sgn (op->op0) >= 0
&& compare_tree_int (op->op0, TREE_STRING_LENGTH (arg0->op0)) < 0)
return build_int_cst_type (op->type,
(TREE_STRING_POINTER (arg0->op0)