On Wed, Jul 21, 2021 at 10:06:51AM +0200, Richard Biener wrote: > c_common_mark_addressable_vec fails to look through C_MAYBE_CONST_EXPR > in the case it isn't at the toplevel. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? > > Thanks, > Richard. > > 2021-07-21 Richard Biener <rguent...@suse.de> > > PR c/101512 > gcc/c-family/ > * c-common.c (c_common_mark_addressable_vec): Look through > C_MAYBE_CONST_EXPR even if not at the toplevel. > > * gcc.dg/torture/pr101512.c: New testcase.
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. Jakub