Commit 1b0e3802 by Richard Guenther Committed by Richard Biener

re PR lto/45667 (ICE: verify_stmts failed: type mismatch in address expression with -flto)

2010-10-20  Richard Guenther  <rguenther@suse.de>

	PR lto/45667
	* lto-streamer-out.c (output_gimple_stmt): Fix typo.
	* tree-cfg.c (verify_gimple_call): Properly get the call fndecl.
	(verify_gimple_assign_single): Disable ADDR_EXPR type check
	when in LTO.

	* g++.dg/lto/20101020-1_0.h: New testcase.
	* g++.dg/lto/20101020-1_0.C: Likewise.
	* g++.dg/lto/20101020-1_1.C: Likewise.

From-SVN: r165725
parent 51934590
2010-10-20 Richard Guenther <rguenther@suse.de>
PR lto/45667
* lto-streamer-out.c (output_gimple_stmt): Fix typo.
* tree-cfg.c (verify_gimple_call): Properly get the call fndecl.
(verify_gimple_assign_single): Disable ADDR_EXPR type check
when in LTO.
2010-10-20 Vladimir Makarov <vmakarov@redhat.com> 2010-10-20 Vladimir Makarov <vmakarov@redhat.com>
PR fortran/42169 PR fortran/42169
...@@ -1763,7 +1763,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt) ...@@ -1763,7 +1763,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
if (op) if (op)
{ {
tree *basep = &op; tree *basep = &op;
if (handled_component_p (*basep)) while (handled_component_p (*basep))
basep = &TREE_OPERAND (*basep, 0); basep = &TREE_OPERAND (*basep, 0);
if (TREE_CODE (*basep) == VAR_DECL if (TREE_CODE (*basep) == VAR_DECL
&& !auto_var_in_fn_p (*basep, current_function_decl)) && !auto_var_in_fn_p (*basep, current_function_decl))
......
2010-10-20 Richard Guenther <rguenther@suse.de>
PR lto/45667
* g++.dg/lto/20101020-1_0.h: New testcase.
* g++.dg/lto/20101020-1_0.C: Likewise.
* g++.dg/lto/20101020-1_1.C: Likewise.
2010-10-20 Dmitry Melnik <dm@ispras.ru> 2010-10-20 Dmitry Melnik <dm@ispras.ru>
* gcc.dg/20101013-1.c: New test. * gcc.dg/20101013-1.c: New test.
......
// { dg-lto-do link }
#include "20101020-1_0.h"
A::A ()
{
foo (&A::bar);
}
int main() { return 0; }
struct A;
typedef void (A::*Am1) (void *);
typedef void (A::*Am2) ();
struct B
{
Am2 am2;
};
struct A
{
A ();
struct B b;
struct C *c;
struct D *d;
void foo (Am1);
void bar (void *);
};
struct C
{
};
#include "20101020-1_0.h"
struct D
{
};
void A::bar (void *)
{
}
void A::foo (Am1)
{
}
...@@ -3107,8 +3107,7 @@ verify_gimple_call (gimple stmt) ...@@ -3107,8 +3107,7 @@ verify_gimple_call (gimple stmt)
call, and the decl should have DECL_STATIC_CHAIN set. */ call, and the decl should have DECL_STATIC_CHAIN set. */
if (gimple_call_chain (stmt)) if (gimple_call_chain (stmt))
{ {
if (TREE_CODE (fn) != ADDR_EXPR if (!gimple_call_fndecl (stmt))
|| TREE_CODE (TREE_OPERAND (fn, 0)) != FUNCTION_DECL)
{ {
error ("static chain in indirect gimple call"); error ("static chain in indirect gimple call");
return true; return true;
...@@ -3698,7 +3697,13 @@ verify_gimple_assign_single (gimple stmt) ...@@ -3698,7 +3697,13 @@ verify_gimple_assign_single (gimple stmt)
return true; return true;
} }
if (!types_compatible_p (TREE_TYPE (op), TREE_TYPE (TREE_TYPE (rhs1))) /* Technically there is no longer a need for matching types, but
gimple hygiene asks for this check. In LTO we can end up
combining incompatible units and thus end up with addresses
of globals that change their type to a common one. */
if (!in_lto_p
&& !types_compatible_p (TREE_TYPE (op),
TREE_TYPE (TREE_TYPE (rhs1)))
&& !one_pointer_to_useless_type_conversion_p (TREE_TYPE (rhs1), && !one_pointer_to_useless_type_conversion_p (TREE_TYPE (rhs1),
TREE_TYPE (op))) TREE_TYPE (op)))
{ {
......
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