[rfa] Give thunks correct RESULT_DECL
Michael Matz
matz@suse.de
Wed Jun 1 15:37:00 GMT 2011
Hi,
I noticed this a while ago while working on early merging of decls. When
we build thunk decls ourself we give RESULT_DECL of it integer_type, even
when the thunk decl itself says something else. (In particular thunks can
very well return void or a pointer type). This fixes that glitch.
Regstrapping in progress (on top the wpa[2/n] patch) on x86_64-linux.
Okay for trunk?
Ciao,
Michael.
---------------------------------
* cgraphunit.c (assemble_thunk): Use correct return type.
Index: cgraphunit.c
===================================================================
*** cgraphunit.c (revision 174523)
--- cgraphunit.c (working copy)
*************** assemble_thunk (struct cgraph_node *node
*** 1412,1421 ****
{
const char *fnname;
tree fn_block;
DECL_RESULT (thunk_fndecl)
! = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
! RESULT_DECL, 0, integer_type_node);
fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl));
/* The back end expects DECL_INITIAL to contain a BLOCK, so we
--- 1412,1422 ----
{
const char *fnname;
tree fn_block;
+ tree restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
DECL_RESULT (thunk_fndecl)
! = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
! RESULT_DECL, 0, restype);
fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl));
/* The back end expects DECL_INITIAL to contain a BLOCK, so we
More information about the Gcc-patches
mailing list