https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117197
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |jsm28 at gcc dot gnu.org
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
doing
void d() { struct b e; e.a = 2;}
shows
t.c: In function ‘d’:
t.c:5:30: error: incompatible types when assigning to type ‘__vector(1) int’
from type ‘int’
5 | void d() { struct b e; e.a = 2;}
| ^
so I'm not sure if the initializer should be considered valid.
If valid I would have expected 'c' to fully initialize the vector and
.a = 2 as well? But it seems the C frontend interprets e.a as "aggregate".
If that's intended this should be probably documented in the documentation
of the vector extension.
I'll note that
struct b {
_Complex int a;
};
int c;
void d() { struct b e = {c, .a = 2}; }
results in
struct b e = {.a=__complex__ (2, 0)};
so there's an (undiagnosed) duplicate initialization of e.a here and .a = 2
fully initializes the _Complex int.
I would have expected the vector int case to behave the same
as the _Complex int case here (but I have no idea whether _Complex handling
is correctly following the standard).