This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++] Fix infinite recursion in generic thunk handling

On Tue, 2003-12-16 at 12:33, Richard Sandiford wrote:
> This patch is a tentative fix for g++.jason/thunk1.C and g++.jason/thunk2.
> They started failing on MIPS (and presumably other targets that use the
> generic thunk handling) after the patch for 11878:
> 2003-10-14  Jason Merrill  <>
> 	PR c++/11878
> 	* tree.c (build_target_expr_with_type): Call force_rvalue for
> 	classes with non-trivial copy ctors.
> use_thunk() will build up a call to the real function and then pass that
> CALL_EXPR directly to finish_return_stmt().  If the function returns a
> non-POD type X, and the call expression is C, we end up calling X's
> constructor with C as its argument.  build_over_call() then indirectly
> calls build_target_expr_with_type (C, TREE_TYPE (C)).
> Before the patch for 11878, b_t_e_w_t() would create a temporary and
> initialise it with C, but it now passes C to force_rvalue, which tries
> to build the same call to X::X (C).

I think your patch is OK.

However, the truth of the matter is that the generic thunk code sould
really only be used as a fall-back; there are likely other problems with
it as well.  It would be great if you could implement the new thunk
variants for MIPS, but I don't know how hard that is.

Mark Mitchell <>
CodeSourcery, LLC

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]