From ac7cee3bd5277de328bf96604fd1699fb5fb66da Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 14 May 2010 12:40:18 +0000 Subject: [PATCH] 2010-05-14 Richard Guenther 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/branches/gcc-4_5-branch@159391 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-sccvn.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a911e1d9926..5391c42c780 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2010-05-14 Richard Guenther + + PR tree-optimization/44124 + * tree-ssa-sccvn.c (vn_nary_may_trap): Fix invalid memory access. + 2010-05-13 Jason Merrill * gimplify.c (gimplify_expr) [MODIFY_EXPR]: Trust GS_OK even if the diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 5282978d173..de2f777156a 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -3332,7 +3332,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; @@ -3355,7 +3355,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, -- 2.11.4.GIT