------- Comment #7 from rguenth at gcc dot gnu dot org 2008-02-14 21:19 ------- ISO C even disallows type-punning with unions (which is in fact a GNU extension):
union { int i; float f } u; u.i = 1; return u.f; invokes undefined behavior in ISO C. You have to use memcpy and two different memory objects like int i = 1; float f; memcpy (&f, &i, 4); return f; to be portable and ISO C conformant. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35200