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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
struct b {
  __attribute__((vector_size(4))) int a;
};
int c;
void d() { struct b e = {0, 1, 2, 3}; }

shows

t.c: In function ‘d’:
t.c:5:29: warning: excess elements in struct initializer
    5 | void d() { struct b e = {0, 1, 2, 3}; }
      |                             ^
t.c:5:29: note: (near initialization for ‘e’)
t.c:5:32: warning: excess elements in struct initializer
    5 | void d() { struct b e = {0, 1, 2, 3}; }
      |                                ^
t.c:5:32: note: (near initialization for ‘e’)
t.c:5:35: warning: excess elements in struct initializer
    5 | void d() { struct b e = {0, 1, 2, 3}; }
      |                                   ^
t.c:5:35: note: (near initialization for ‘e’)

and

    struct b e = {.a={ 0 }};

and no ICE.  clang diagnoses the original testcase with

t.c:5:34: warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
    5 | void d() { struct b e = {c, .a = 2}; }
      |                                  ^
t.c:5:26: note: previous initialization is here
    5 | void d() { struct b e = {c, .a = 2}; }
      |                          ^

Reply via email to