]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/44124 (valgrind reports invalid read while compiling compile...
authorRichard Guenther <rguenther@suse.de>
Fri, 14 May 2010 12:36:28 +0000 (12:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 May 2010 12:36:28 +0000 (12:36 +0000)
2010-05-14  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/44124
* tree-ssa-sccvn.c (vn_nary_may_trap): Fix invalid memory access.

From-SVN: r159390

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

index 33134343782deb49f06164d8a44a98df3131d2b4..936da30123c0e3e7ffa5cd4f78e0c7dfc5859ad3 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-14  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/44124
+       * tree-ssa-sccvn.c (vn_nary_may_trap): Fix invalid memory access.
+
 2010-05-14  Alan Modra  <amodra@gmail.com>
 
        PR target/44075
index f965c5134e5c6dd618c2e06cf247182550ee8992..0a7feafe0d7fda3627692c62b30152dd2019ddaf 100644 (file)
@@ -3408,7 +3408,7 @@ bool
 vn_nary_may_trap (vn_nary_op_t nary)
 {
   tree type;
-  tree rhs2;
+  tree rhs2 = NULL_TREE;
   bool honor_nans = false;
   bool honor_snans = false;
   bool fp_operation = false;
@@ -3431,7 +3431,8 @@ vn_nary_may_trap (vn_nary_op_t nary)
               && TYPE_OVERFLOW_TRAPS (type))
        honor_trapv = true;
     }
-  rhs2 = nary->op[1];
+  if (nary->length >= 2)
+    rhs2 = nary->op[1];
   ret = operation_could_trap_helper_p (nary->opcode, fp_operation,
                                       honor_trapv,
                                       honor_nans, honor_snans, rhs2,