New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test.cmath fails on OS/X with gcc-4.8 in non-debug build #62713
Comments
====================================================================== Traceback (most recent call last):
File "/Users/raymondhettinger/cpython/Lib/test/test_cmath.py", line 382, in test_specific_values
msg=error_message)
File "/Users/raymondhettinger/cpython/Lib/test/test_cmath.py", line 128, in rAssertAlmostEqual
'got {!r}'.format(a, b))
AssertionError: rect1017: rect(complex(0.0, -0.0))
Expected: complex(0.0, -0.0)
Received: complex(0.0, 0.0)
Received value insufficiently close to expected value. |
Hmm. Looks similar to issue bpo-15477, but that one was fixed (we added a local workaround and reported the OS bug to Apple). And it was with clang rather than gcc. Raymond: from the title, can I assume that you don't see this failure on a debug build? That would tend to point to a compiler optimization bug. |
I can't reproduce this here on OS 10.6 (I don't have access to anything later), but I think I can guess what's happening: I suspect that gcc 4.8 is optimizing the pair of 'cos' and 'sin' calls into a single call to 'cexp'. And then the OS X library implementation of _cexp has buggy behaviour with respect to signs of zeros (this last part is something I've witnessed before, but I forget which version of OS X it was on). It's easy to work around, by adding a special case for zeros in cmath_rect. It's a bit annoying to have to do so, though. |
New changeset ce771c2d0220 by Mark Dickinson in branch '3.3': New changeset ae769deb45b2 by Mark Dickinson in branch 'default': |
Should be fixed now. |
New changeset 91374660355a by Raymond Hettinger in branch '2.7': |
Thanks Mark. test_cmath passed now. I've also applied this to Python2.7. |
Thanks, Raymond. Postscript: I had a feeling of deja vu about this, and I've just been searching through old emails. It turns out I filed an OS X bug (#6466807 ) for this exact issue back in 2008; cexp was broken in 10.5, fixed in 10.6, and clearly is now broken again in 10.8. I've added a note to that Apple bug report, for what it's worth. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: