re PR tree-optimization/57385 ([tree-ssa] Possible segfault in fully_constant_vn_refe...
authorAlexander Ivchenko <alexander.ivchenko@intel.com>
Fri, 24 May 2013 09:08:45 +0000 (09:08 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Fri, 24 May 2013 09:08:45 +0000 (09:08 +0000)
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.

From-SVN: r199282

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-ssa-sccvn.c

index ae1d9b5c0f7baebe147e8fc044fc52c78df2bb82..01f77cbfa87214f93a35f231c659c8cdbea584eb 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-24  Alexander Ivchenko  <alexander.ivchenko@intel.com>
+
+       PR tree-ssa/57385
+       * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Check
+       that index is not negative.
+
 2013-05-24  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR rtl-optimization/55177
index f9ef3c062a7e79cb79b609d06e5131bc2ce26c9d..ca359e4ef6866bf04202a8b5f0abbe55efa103ae 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-24  Alexander Ivchenko  <alexander.ivchenko@intel.com>
+
+       PR tree-ssa/57385
+       * gcc.dg/tree-ssa/pr57385.c: New test.
+
 2013-05-24  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/derived_type4.adb: New test.
index 49d61b0c239647f4ffcd598f1078f0cb5955c1fc..0e7a74c2a9c3d0be641600c9020cefd9ce22c8f3 100644 (file)
@@ -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)