On Wed, 21 Jul 2021, Jakub Jelinek via Gcc-patches wrote:

> I wonder if instead when trying to wrap
> C_MAYBE_CONST_EXPR into a VIEW_CONVERT_EXPR we shouldn't be
> removing that C_MAYBE_CONST_EXPR and perhaps adding it around the
> VIEW_CONVERT_EXPR.  E.g. various routines in c/c-typeck.c like
> build_unary_op remember int_operands, remove_c_maybe_const_expr
> and at the end note_integer_operands.
> 
> If Joseph thinks it is ok to have C_MAYBE_CONST_EXPR inside of
> VCE, then the patch looks good to me.

There are specific cases when a C_MAYBE_CONST_EXPR mustn't appear inside 
another expression: any case where the inner expression is required to be 
fully folded (this implies nested C_MAYBE_CONST_EXPR aren't allowed) and 
any case where the expression might appear (possibly unevaluated) in an 
integer constant expression (any C_MAYBE_CONST_EXPR noting that needs to 
be at top level).

If the expressions involved here can never appear in an integer constant 
expression and do not need to be fully folded, I think it's OK to have 
C_MAYBE_CONST_EXPR inside VIEW_CONVERT_EXPR.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to