[cfe-dev] Issue with designated initializers and vectors
Mattias Holm
holm at liacs.nl
Sat Jun 13 04:27:54 PDT 2009
Eli Friedman wrote:
>
> Thanks for the report; fixed in r73292.
>
> -Eli
Thanks works fine now :)
Here is another one, the parser and sema works fine in this case but the
code generator does something wrong I think. The following program
segfaults when built with clang (tested on darwin x86 both 32 and 64 bit
targets), but works fine with GCC.
It crashes on the line p.v[0] = a->v[0] * v.v;
typedef float __attribute__((vector_size (16))) v4f_t;
typedef union {
float a[4];
struct {
float x, y, z, w;
}s;
v4f_t v;
} vector_t;
typedef union {
float a[4][4];
v4f_t v[4];
} matrix_t;
vector_t
foo(const matrix_t *a, const vector_t v)
{
vector_t vr;
matrix_t p;
p.v[0] = a->v[0] * v.v;
vr.v = p.v[0];
return vr;
}
int
main(int argc, char **argv)
{
matrix_t m;
for (int i = 0 ; i < 4; i ++) {
for (int j = 0 ; j < 4; j ++) {
m.a[i][j] = 1.0;
}
}
vector_t v = {.a = {1.0, 1.0, 1.0, 1.0}};
vector_t r = foo(&m, v);
return 0;
}
/ Mattias
More information about the cfe-dev
mailing list