------- Comment #13 from rguenth at gcc dot gnu dot org 2008-11-30 11:43 ------- Note that the C standard forbids type-punning through a union. Basically it says that you may only read from a union member if you have previously written to it. It also says that all other bits apart from the ones you have written to contain undefined values after the write. So
union { int i; float f; } u; u.i = 1; x = u.f; invokes undefined behavior in C (but not in GNU C because of the language extension). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38297