http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48236
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |i?86-*-* Status|UNCONFIRMED |RESOLVED Component|c |target Resolution| |DUPLICATE --- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-22 15:15:24 UTC --- The issue seems to be a x87 specific one. We expand the conversions to ;; if (D.2537_5 != D.2538_6) (insn 22 20 23 4 t.c:9 (set (reg:SF 66) (float:SF (reg/v:DI 62 [ i ]))) -1 (nil)) (insn 23 22 24 4 t.c:9 (set (reg:XF 68) (float:XF (reg/v:DI 63 [ ui ]))) -1 (nil)) (insn 24 23 25 4 t.c:9 (set (reg:CCGOC 17 flags) (compare:CCGOC (subreg:SI (reg/v:DI 63 [ ui ]) 4) (const_int 0 [0x0]))) -1 (nil)) and later (insn 55 20 56 4 t.c:9 (parallel [ (set (reg:SF 9 st(1) [66]) (float:SF (reg/v:DI 1 dx [orig:62 i ] [62]))) (clobber (mem/c:DI (plus:SI (reg/f:SI 7 sp) (const_int 16 [0x10])) [0 S8 A64])) ]) 226 {*floatdisf2_i387_with_temp} (nil)) (insn 56 55 24 4 t.c:9 (parallel [ (set (reg:XF 8 st [68]) (float:XF (reg/v:DI 1 dx [orig:62 i ] [62]))) (clobber (mem/c:DI (plus:SI (reg/f:SI 7 sp) (const_int 16 [0x10])) [0 S8 A64])) ]) 230 {*floatdixf2_i387_with_temp} (nil)) so for some reason we miss truncation to SFmode. We also seem to account for the fact that the used fildq instruction operates on signed input only by compensating with the addition of a bias - but that obviously changes rounding behavior and is not suitable w/o -funsafe-math-optimizations (we do add a FP bias, not an integer bias, and we probably think using XFmode for it makes it ok). With -std=c99 and GCC 4.5 the code works as expected as we properly truncate the XFmode result, that is -fexcess-precision=standard. *** This bug has been marked as a duplicate of bug 323 ***