summaryrefslogtreecommitdiff
path: root/gcc/vtable-verify.c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-10 10:49:39 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2013-12-10 10:49:39 +0000
commit475a6b35b36e653a9b82d16e4665caabc145ff18 (patch)
tree71efd97b5906d97af26d89bded42ae258596e14d /gcc/vtable-verify.c
parent2721751cdd07eba7e63fc4e539dc40945dbc7d00 (diff)
downloadgcc-475a6b35b36e653a9b82d16e4665caabc145ff18.tar.gz
PR sanitizer/59437
* vtable-verify.c (var_is_used_for_virtual_call_p): Check the return value of gimple_call_fn. Use is_gimple_call/is_gimple_assign instead of gimple_code. testsuite/ * g++.dg/ubsan/pr59437.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205854 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/vtable-verify.c')
-rw-r--r--gcc/vtable-verify.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index dabb77b9d10..af61e930b20 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -513,10 +513,10 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth)
{
gimple stmt2 = USE_STMT (use_p);
- if (gimple_code (stmt2) == GIMPLE_CALL)
+ if (is_gimple_call (stmt2))
{
tree fncall = gimple_call_fn (stmt2);
- if (TREE_CODE (fncall) == OBJ_TYPE_REF)
+ if (fncall && TREE_CODE (fncall) == OBJ_TYPE_REF)
found_vcall = true;
else
return false;
@@ -527,7 +527,7 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth)
(gimple_phi_result (stmt2),
mem_ref_depth);
}
- else if (gimple_code (stmt2) == GIMPLE_ASSIGN)
+ else if (is_gimple_assign (stmt2))
{
tree rhs = gimple_assign_rhs1 (stmt2);
if (TREE_CODE (rhs) == ADDR_EXPR