This is the mail archive of the gcc-patches@gcc.gnu.org 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++ PATCH] c++/78495 inherited ctor and inivis-ref parm


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


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