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: VIEW_CONVERT_EXPR slots for strict-align targets (PR 83884)


> 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


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