This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: VIEW_CONVERT_EXPR slots for strict-align targets (PR 83884)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Sandiford <richard dot sandiford at linaro dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Jan 2018 21:24:54 +0100
- Subject: Re: VIEW_CONVERT_EXPR slots for strict-align targets (PR 83884)
- Authentication-results: sourceware.org; auth=none
- References: <87vag1wzk5.fsf@linaro.org>
> I'd assumed that variable-length types couldn't occur here, since it
> seems strange to view-convert a variable-length type to a fixed-length
> one.
This happens all the time in Ada when you convert an unconstrained type into
one of its constrained subtypes (but the run-time sizes must match).
> But is this VIEW_CONVERT_EXPR really valid? Maybe this is just
> papering over a deeper issue. There again, the MAX in the old
> code was presumably there because the sizes can be different...
The problem is that Ada exposes VIEW_CONVERT_EXPR to the user and the user can
do very weird things with it so you need to be prepared for the worst.
> 2018-01-16 Richard Sandiford <richard.sandiford@linaro.org>
>
> gcc/
> PR middle-end/83884
> * expr.c (expand_expr_real_1): Use the size of GET_MODE (op0)
> rather than the size of inner_type to determine the stack slot size
> when handling VIEW_CONVERT_EXPRs on strict-alignment targets.
This looks good to me, thanks for fixing the problem. Unexpectedly enough, I
don't see the failures on SPARC (32-bit or 64-bit).
--
Eric Botcazou