https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63764

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to jos...@codesourcery.com from comment #7)
> On Tue, 18 Nov 2014, jakub at gcc dot gnu.org wrote:
> What folds away the VIEW_CONVERT_EXPR, when?  c-typeck.c:lvalue_p does not 
> consider VIEW_CONVERT_EXPRs to be lvalues, and lvalue checks are meant to 
> happen before any folding that could change a non-lvalue to an lvalue.
> 
> Maybe build_array_ref needs to ensure that references to elements of 
> non-lvalue vectors don't become lvalues?  (This would be different to 
> non-lvalue arrays arising from non-lvalue structs and unions, where the 
> result of an array reference *is* an lvalue but modifying it, or accessing 
> it after the next sequence point, has undefined behavior.)

Apparently I misremembered it, trying it again, I see the VCE still there in
*vecp upon entry to convert_vector_to_pointer_for_subscript, the difference
between VIEW_CONVERT_EXPR and NON_LVALUE_EXPR is just that
c_common_mark_addressable_vec looks through VCE and marks the inner part as
addressable (because VCE is handled_component_p), while for non_lvalue_expr it
does not.

So, shall we convert_vector_to_pointer_for_subscript add something like
  if (!lvalue_p (*vecp))
    error_at (...); ?
What wording for it?

Reply via email to