https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77443
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org, | |ppalka at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Various cases like that have been over the years solved with RANGE_EXPRs in the initializers, which we during gimplification sometimes decide to emit using loops. I think a problem with that in this case is that we have {TARGET_EXPR <D.62426, <<< Unknown tree: aggr_init_expr 4 __ct_comp D.62426 (struct MyObject *) <<< Unknown tree: void_cst >>> >>>>, TARGET_EXPR <D.62427, <<< Unknown tree: aggr_init_expr 4 __ct_comp D.62427 (struct MyObject *) <<< Unknown tree: void_cst >>> >>>>, TARGET_EXPR <D.62428, <<< Unknown tree: aggr_init_expr 4 __ct_comp D.62428 (struct MyObject *) <<< Unknown tree: void_cst >>> >>>>, ... } and using a RANGE_EXPR for that in the CONSTRUCTOR would mean we'd construct once and bitwise copy to all the elements in the range. That would be valid for this particular testcase because the constructor does nothing, but not generally valid for arbitrary constructors. So, either we need a different syntax or say some flag on RANGE_EXPR that would tell that rather than computing the value once and copying to every element in the range we need to either initialize in a loop where we construct those elements inside of the loop, or, if we decide not to emit a loop (e.g. because it is just very few elts), duplicate the construction the way it is seen in the above snippet.