Commit ed9e19a4 by Marek Polacek Committed by Marek Polacek

re PR sanitizer/59437 (ICE in for g++ -S -fvtable-verify=std -fsanitize=null)

	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.

From-SVN: r205854
parent 475948fa
2013-12-10 Marek Polacek <polacek@redhat.com>
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.
2013-12-10 Maxim Kuvyrkov <maxim@kugelworks.com> 2013-12-10 Maxim Kuvyrkov <maxim@kugelworks.com>
* config.gcc (mips*-mti-linux*, mips64*-*-linux*): * config.gcc (mips*-mti-linux*, mips64*-*-linux*):
2013-12-09 Marek Polacek <polacek@redhat.com>
PR sanitizer/59437
* g++.dg/ubsan/pr59437.C: New test.
2013-12-10 Max Ostapenko <m.ostapenko@partner.samsung.com> 2013-12-10 Max Ostapenko <m.ostapenko@partner.samsung.com>
* c-c++-common/tsan/thread_leak2.c: `dg-skip-if' removed. * c-c++-common/tsan/thread_leak2.c: `dg-skip-if' removed.
......
// { dg-do compile }
// { dg-options "-fsanitize=null -fvtable-verify=std" }
// { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
template < typename T > struct A
{
T foo ();
};
template < typename T > struct C: virtual public A < T >
{
C & operator<< (C & (C &));
};
template < typename T >
C < T > &endl (C < int > &c)
{
c.foo ();
return c;
}
C < int > cout;
void
fn ()
{
cout << endl;
}
...@@ -513,10 +513,10 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth) ...@@ -513,10 +513,10 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth)
{ {
gimple stmt2 = USE_STMT (use_p); gimple stmt2 = USE_STMT (use_p);
if (gimple_code (stmt2) == GIMPLE_CALL) if (is_gimple_call (stmt2))
{ {
tree fncall = gimple_call_fn (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; found_vcall = true;
else else
return false; return false;
...@@ -527,7 +527,7 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth) ...@@ -527,7 +527,7 @@ var_is_used_for_virtual_call_p (tree lhs, int *mem_ref_depth)
(gimple_phi_result (stmt2), (gimple_phi_result (stmt2),
mem_ref_depth); mem_ref_depth);
} }
else if (gimple_code (stmt2) == GIMPLE_ASSIGN) else if (is_gimple_assign (stmt2))
{ {
tree rhs = gimple_assign_rhs1 (stmt2); tree rhs = gimple_assign_rhs1 (stmt2);
if (TREE_CODE (rhs) == ADDR_EXPR if (TREE_CODE (rhs) == ADDR_EXPR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment