[PATCH RFA] tree-inline: Fix VLA handling [PR95552]

Jason Merrill jason@redhat.com
Mon Jun 8 20:51:50 GMT 2020


On 6/8/20 4:19 PM, Jason Merrill wrote:
> On 6/8/20 5:46 AM, Eric Botcazou wrote:
>>> The only case handled specially is TYPE_DECL; other DECL_EXPRs fall
>>> through to the default case, where we WALK_SUBTREE over all the operands
>>> of the expression, which for DECL_EXPR is the decl.
>>
>> It seems hard to believe that the inliner relies on this to copy DECLs 
>> though,
> 
> I agree!  I imagine the actual inliner is unaffected because that 
> happens in GIMPLE now, so this only affects FE cloning.  I don't know if 
> any other front ends use a walk_tree callback like copy_tree_body_r that 
> would replace a type in the same way.
> 
>> see the calls to remap_decl[s].
> 
> Which ones?
> 
>> And note that remap_decl has had a special
>> handling for DECL_ORIGINAL_TYPE of TYPE_DECLs since 2003.
> Yes, but the problem is that remap_decl isn't getting called.
> 
>> Are you sure the
>> problem is not that the TYPE_DECL is not attached to the enclosing 
>> BIND_EXPR?
> 
> Attaching it to the BIND_EXPR doesn't help walk_tree_1 do the right 
> thing with the DECL_EXPR.

We could also work around this in copy_tree_body_r as follows, but I 
imagined that other tree walking functions might also be affected by the 
missing call for the TYPE_DECL of a DECL_EXPR.

Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: copy-body-type.diff
Type: text/x-patch
Size: 809 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200608/a074aff5/attachment.bin>


More information about the Gcc-patches mailing list