This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Properly unshare TYPE_SIZE_UNIT/DECL_FIELD_OFFSET (PR86216)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 13 Jul 2018 13:56:23 +0200
- Subject: Re: [PATCH] Properly unshare TYPE_SIZE_UNIT/DECL_FIELD_OFFSET (PR86216)
- References: <alpine.LSU.email@example.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jul 13, 2018 at 01:49:38PM +0200, Richard Biener wrote:
> The testcase in the PR, while previously ICEing because the C++ FE doesn't
> properly capture VLA size fields, now ICEs because gimplification
> introduces SSA uses that appear in a different function than its
> definition. This happens because there is tree sharing between
> the functions. For nested functions (which the C++ lambdas are not)
> such tree sharing ended up being harmless before GCC7 because unnesting
> resolves all locals with wrong origin to the static chain (and
> gimplification ordering made sure definitions always appear in the
> outer function).
> The following resolves this by unsharing size expressions in c-common.c
> I realize that this may end up pessimizing early code since 1:1
> tree-sharing with what is gimplified from a DECL_EXPR doesn't
> share the gimplification result.
I think the unsharing is just wrong, we never want to unshare those,
the SAVE_EXPR expression needs to be evaluated at the DECL_EXPR point and
never anywhere else, never twice (it could have side-effects etc.).
The C++ FE must be fixed to handle the lambda cases.
> Another option might be to force gimplification to not generate
> SSA temporaries when gimplifying size positions but gimplify_one_sizepos
> oddly enough unshares trees before gimplifying ...(!?) This would
> need to be removed (see patch after the tested patch below).
I like that gimplify_one_sizepos change much more (I guess we need a
Lambdas were broken even before GCC7, while we might not ICE, we certainly
didn't generate correct code.