This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] c++/78495 inherited ctor and inivis-ref parm
- From: Jason Merrill <jason at redhat dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 20 Jan 2017 08:45:38 -0500
- Subject: Re: [C++ PATCH] c++/78495 inherited ctor and inivis-ref parm
- Authentication-results: sourceware.org; auth=none
- References: <c4cfe14b-34c2-67f6-4954-85cc5e347ba5@acm.org>
On Fri, Jan 20, 2017 at 8:15 AM, Nathan Sidwell <nathan@acm.org> wrote:
> Bug 78495 is a wrong code bug caused by an invisiref parm. When building
> the inherited ctor, we use forward_parm to create a forwarding reference.
> That code generation considers the type of the parm to be 'T'. We thus end
> up with a tree that looks like *&PARM
>
> The subsequent call gets 'CALL_FROM_THUNK' set. We need that set so code
> generation doesn't copy pass-by-invisiref objects that are specified by the
> C abi (but not specified so by the C++ abi) (POD structs, commonly).
>
> cp_genericize is used to mutate invisiref parm_decls from T to &T and bash
> their uses from PARM to *PARM (with suitable checking of &PARM turning into
> plain PARM). However it explicitly skips genericizing the args of a
> CALL_FROM_THUNK tree. Thus we end up taking the address of the reference
> parm itself.
>
> That appears to be incorrect now we have forward_parm. This patch deletes
> that skipping.
Hmm, I would guess that if we're going to do this we need to also use
forward_parm in maybe_thunk_body.
Jason