[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-03-19 Thread STINNER Victor
STINNER Victor added the comment: The root issue was a bug in GCC which has been fixed. Fedora Rawhide got the new fixed GCC and so I close the issue. -- resolution: -> third party stage: patch review -> resolved status: open -> closed ___ Python

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-30 Thread STINNER Victor
STINNER Victor added the comment: The GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88892 has been fixed in the development branch ("trunk"): https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=268083 I requested a fix for GCC 8.2. -- __

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-18 Thread Stefan Krah
Change by Stefan Krah : -- assignee: -> skrah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer
Florian Weimer added the comment: No, GCC will optimize away the union. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Would it help if define PACK_SINGLE as below? #define PACK_SINGLE(ptr, src, type) \ do { \ union { \ type value; \ unsigned char raw[siz

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah
Stefan Krah added the comment: > For me, the main risk is to forget to remove the workaround once a new GCC > version will be released (in N months). This is why I suggested using the reproducer in configure.ac, setting something like HAVE_GCC_MEMCPY_ROUNDING_BUG and then either a) wrap the *

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
STINNER Victor added the comment: "Or to put it differently, should we put a specific fix for a single gcc version into memoryview.c? For all we know, a fix will be pushed to Fedora 28 in the next 4 months." Right now, test_buffer is skipped in the python3.spec of Fedora (recipe to build the

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
STINNER Victor 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.101 (gdb) disassemble $pc,$pc+40 => 0x10078fbc :

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer
Florian Weimer added the comment: We don't know yet if the GCC bug is specific to POWER. That depends on what causes it. Other targets my have double-to-float conversion instructions which hard-code the wrong rounding mode. -- ___ Python tracker

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah
Stefan Krah added the comment: Or to put it differently, should we put a specific fix for a single gcc version into memoryview.c? For all we know, a fix will be pushed to Fedora 28 in the next 4 months. -- ___ Python tracker

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah
Stefan Krah added the comment: Our mails apparently crossed. :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah
Stefan Krah added the comment: Okay, so it's not a severe bug. That leaves us with the question what to do about it. As I said above, other call sites could be affected, too: _struct.c: static int np_float(char *p, PyObject *v, const formatdef *f) { float x = (float)PyFloat_AsDouble(v);

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
STINNER Victor added the comment: The bug occurs when GCC emits a single instruction (stxsspx) for cast + memcpy. I understand that the struct module is not affected because there is a condition branch (if) between the cast ("float x = ...") and the memcpy(). static int np_float(char *p, PyO

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
STINNER Victor added the comment: > If gcc-8.0.1-0.14.fc28.ppc64le miscompiles memcpy(), perhaps the upstream > priority in https://bugzilla.redhat.com/show_bug.cgi?id=1540995 should be > "release blocker". With the bug, memoryview doesn't round properly float: rounds to zero rather than ro

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +11291, 11292, 11293 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-lis

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +11291, 11292 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list maili

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +11291 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer
Florian Weimer added the comment: I believe this is a GCC bug, and filed . -- ___ Python tracker ___ _

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Florian Weimer
Change by Florian Weimer : -- nosy: +fweimer ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread STINNER Victor
STINNER Victor added the comment: Extract of memoryview pack_signal() function: #define PACK_SINGLE(ptr, src, type) \ do { \ type x; \ x = (type)src; \ memcpy(ptr, (char *)&x, siz

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-17 Thread Stefan Krah
Stefan Krah added the comment: If gcc-8.0.1-0.14.fc28.ppc64le miscompiles memcpy(), perhaps the upstream priority in https://bugzilla.redhat.com/show_bug.cgi?id=1540995 should be "release blocker". CC David Edelsohn, whose PPC64 buildbot (presumably big endian) works. -- nosy: +David

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread Charalampos Stratakis
Charalampos Stratakis added the comment: Possibly relevant: https://fedoraproject.org/wiki/Changes/PPC64LE_Float128_Transition#Detailed_Description But the work is not complete. -- ___ Python tracker _

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread Stefan Krah
Stefan Krah added the comment: Does it also work with -fno-inline, just for ppc64? There are other places in the sources where an inlined memcpy() could be miscompiled. -- ___ Python tracker

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread STINNER Victor
STINNER Victor added the comment: > This is a performance sensitive function, so I prefer not to add volatile. I don't suggest to use volatile. I'm just pointing to the function causing the bug and I said that volatile worked for me :-) I made my tests on: * Red Hat Enterprise Linux release

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread Stefan Krah
Stefan Krah added the comment: This is a performance sensitive function, so I prefer not to add volatile. MSVC also had a bug with that function, but only in PGO mode. Microsoft has fixed the issue long ago. Do newer gcc versions have this issue? I'm fine with wrapping the entire macro in an

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread Charalampos Stratakis
Change by Charalampos Stratakis : -- nosy: +cstratak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch Added file: https://bugs.python.org/file48061/pack_single.patch ___ Python tracker ___ __

[issue35752] test_buffer fails on ppc64le: memoryview pack_single() is miscompiled

2019-01-16 Thread STINNER Victor
New submission from STINNER Victor : The bug was first reported on Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1540995 == FAIL: test_memoryview_struct_module (test.test_buffer.TestBufferProtocol) ---