------- Comment #4 from mikpe at it dot uu dot se 2010-06-23 12:12 ------- Created an attachment (id=20986) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20986&action=view) test long long to double runtime conversions
Making the constant signed rather than unsigned makes no difference. I converted the test case to do the conversions at runtime and to print the hex representations of the long long and double values. Here's some results: > gcc -O2 -m32 -mcpu=v8 pr44631.c ; ./a.out 97979797979797980 (0x015c181b6dc019dc) -> 9.79798e+16 (0x4375c181b6dc019e) 72057594037927936 (0x0100000000000000) -> 7.20576e+16 (0x4370000000000000) 72057594037927935 (0x00ffffffffffffff) -> 7.20576e+16 (0x4370000000000000) This looks fine, but the topmost two values have been rounded. > gcc -O2 -m32 -mcpu=v9 pr44631.c ; ./a.out 97979797979797980 (0x015c181b6dc019dc) -> 2.47804e+17 (0x438b83036db8033c) 72057594037927936 (0x0100000000000000) -> 1.44115e+17 (0x4380000000000000) 72057594037927935 (0x00ffffffffffffff) -> 7.20576e+16 (0x4370000000000000) Note the discontinuity. Looks to me like fxtod fails to round and instead produces a large jump in the exponent. Does gcc assume some specific setting in FSR? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44631