OSDN Git Service

2010-05-14 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 May 2010 12:36:28 +0000 (12:36 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 May 2010 12:36:28 +0000 (12:36 +0000)
PR tree-optimization/44124
* tree-ssa-sccvn.c (vn_nary_may_trap): Fix invalid memory access.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159390 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 3313434..936da30 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 f965c51..0a7feaf 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,