On Fri, Jul 31, 2020 at 11:41:59AM +0100, Richard Sandiford wrote:
> @@ -10135,11 +10176,7 @@ process_init_element (location_t loc, struct c_expr 
> value, bool implicit,
>         /* Otherwise, if we have come to a subaggregate,
>            and we don't have an element of its type, push into it.  */
>         else if (value.value != NULL_TREE
> -                && value.value != error_mark_node
> -                && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype
> -                && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
> -                    || fieldcode == UNION_TYPE
> -                    || gnu_vector_type_p (fieldtype)))
> +                && initialize_elementwise_p (fieldtype, value.value))

I wonder if it wouldn't be better to do the value.value != NULL_TREE
checking inside of initialize_elementwise_p too, simply because it is done
the same way in all the 3 callers.

Other than that LGTM, but as I'm not a C FE maintainer, please give them a day
to express their opinions (though Joseph commented in the PR, so I assume he
is ok with the general idea).

>           {
>             push_init_level (loc, 1, braced_init_obstack);
>             continue;
> @@ -10227,11 +10264,7 @@ process_init_element (location_t loc, struct c_expr 
> value, bool implicit,
>         /* Otherwise, if we have come to a subaggregate,
>            and we don't have an element of its type, push into it.  */
>         else if (value.value != NULL_TREE
> -                && value.value != error_mark_node
> -                && TYPE_MAIN_VARIANT (TREE_TYPE (value.value)) != fieldtype
> -                && (fieldcode == RECORD_TYPE || fieldcode == ARRAY_TYPE
> -                    || fieldcode == UNION_TYPE
> -                    || gnu_vector_type_p (fieldtype)))
> +                && initialize_elementwise_p (fieldtype, value.value))
>           {
>             push_init_level (loc, 1, braced_init_obstack);
>             continue;

        Jakub

Reply via email to