EXC_BAD_ACCESS and char pointer to float pointer cast
<p>I'm currently writing a file loader for an ipad program and I'm getting strange EXC_BAD_ACCESS exceptions. Here is a short snipped of code that I think is the reason for the error:</p>

<pre><code>float testFloat() {
    char mem[32];
    char *charPtr = &amp;mem[0];
    float *floatPtr = (float*)(charPtr + 1);
    float f = *floatPtr; //EXC_BAD_ACCESS
    return f;
}
</code></pre>

<p>The error happens only if the offset of charPtr is not divisible by 4, so I guess it could have something to do with pointer alignment on ARM CPUs.</p>
