ispc/ispc — Issue #122: soa_to_aos3 crash
Author: null77
Created: 2011-11-26 20:06:20+00:00
State: open

The following kernel causes a crash, with a null pointer dereference, in my case. (1.0.12)

Uncommenting the raw memory writes works fine.

The method sometimes doesn't crash, but I call it multiple times, with different values of a, b, c, d, and different pointers for baryCoords and out.

Maybe I'm doing something wrong? Sorry if this is wasting your time.

```c

struct V3f
{
uniform float x, y, z;
};

export void ResolveBaryCoords(
uniform int count,
uniform reference V3f a, uniform reference V3f b, uniform reference V3f c, uniform reference V3f d,
reference uniform float baryCoords[],
reference uniform float out[]
)
{
uniform int base4 = 0;
uniform int base3 = 0;
float va, vb, vc, vd;

for (int i = programIndex; i < count; i += programCount)
{
aos_to_soa4(baryCoords, base4, va, vb, vc, vd);
float x = a.x * va + b.x * vb + c.x * vc + d.x * vd;
float y = a.y * va + b.y * vb + c.y * vc + d.y * vd;
float z = a.z * va + b.z * vb + c.z * vc + d.z * vd;
//	out[base3 + programIndex*3] = x;
//	out[base3 + programIndex*3 + 1] = y;
//	out[base3 + programIndex*3 + 2] = z;
soa_to_aos3(x, y, z, out, base3);
base4 += programCount*4;
base3 += programCount*3;
}
}
```