STINNER Victor <[email protected]> added the comment:
A colleague working on clang asked me to test clang: no, clang doesn't have the
bug. test_buffer pass as expected with clang -O3.
Machine code of the cast + memcpy:
(gdb) p $f31
$1 = -21.100000000000001
(gdb) disassemble $pc,$pc+40
=> 0x0000000010078fbc <pack_single+380>: frsp f0,f31
0x0000000010078fc0 <pack_single+384>: li r3,0
0x0000000010078fc4 <pack_single+388>: stfsx f0,0,r29
(gdb) stepi
0x0000000010078fc0 1824 PACK_SINGLE(ptr, d, float);
(gdb) p $f0
$3 = -21.100000381469727
(gdb) stepi
0x0000000010078fc4 1824 PACK_SINGLE(ptr, d, float);
(gdb) stepi
0x0000000010078fc8 1824 PACK_SINGLE(ptr, d, float);
(gdb) p /x (*ptr)@4
$8 = {0xcd, 0xcc, 0xa8, 0xc1}
The first byte is 0xcd: GOOD.
Florian explained in the GCC bug report that "frsp" is needed and clang emits
it.
"This is incorrect because stfs rounds to zero. An frsp instruction is missing
before the stfs (and would be emitted without the memcpy)."
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88892#c0
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35752>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com