I'm developing an application with GCC 3.4 for ARM7.
When doing following:
(where T_u32 is unsinged int, and T_f32 is 32-bit is float)
I'm getting following warning:
dereferencing type-punned pointer will break strict-aliasing rules
It only happens using -O2 optimization (-O0 reports no warning)
What is exactly strict aliasing? So far, I know there's lot of stuff to be taken into account regarding the way ARM aligns pointers. I do the code above to get a temp_u32 containing the four bytes in the float, as they come. Am I going to have trouble?
When doing following:
Code:
T_f32 temp_f32; T_u32 temp_u32; temp_u32 = *((T_u32 *) &temp_f32);
I'm getting following warning:
dereferencing type-punned pointer will break strict-aliasing rules
It only happens using -O2 optimization (-O0 reports no warning)
What is exactly strict aliasing? So far, I know there's lot of stuff to be taken into account regarding the way ARM aligns pointers. I do the code above to get a temp_u32 containing the four bytes in the float, as they come. Am I going to have trouble?
Comment