Message333882
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 |
|
Date |
User |
Action |
Args |
2019-01-17 15:20:49 | vstinner | set | recipients:
+ vstinner, mark.dickinson, skrah, fweimer, David.Edelsohn, cstratak |
2019-01-17 15:20:47 | vstinner | set | messageid: <1547738447.34.0.0959543071917.issue35752@roundup.psfhosted.org> |
2019-01-17 15:20:47 | vstinner | link | issue35752 messages |
2019-01-17 15:20:47 | vstinner | create | |
|