summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-05-14 12:36:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-05-14 12:36:28 +0000
commit6141b7db4599e176bddab4b4573d4e08a8284ed7 (patch)
treea71ce6cdfdeebe82a1aa1ce4bc29ca2a5d7ae297 /gcc/tree-ssa-sccvn.c
parent88e09c797b51a5351ae3a7c599b530cfb2708be6 (diff)
downloadgcc-6141b7db4599e176bddab4b4573d4e08a8284ed7.tar.gz
re PR tree-optimization/44124 (valgrind reports invalid read while compiling compile/pr34091.c)
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
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index f965c5134e5..0a7feafe0d7 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -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,