This may well be a bug in the implementation I'm using, but I wanted to check if this is sound code.

In my kernel I have the following lines:
Code :
float func (float4 p) {
    float4 ip, fp;
    fp = fract(p, &ip);
    [rest of function snipped....]
This compiles fine, but at runtime (on the CPU under snow leopard) produces a <EXC_BAD_ACCESS> error. Am I doing something wrong here? Have I mis-interpretted how to use that function?

Removing the call to fract cures the problem.