Bug 1390683 - glibc: incorrect argument reduction for cos
Summary: glibc: incorrect argument reduction for cos
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 24
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Florian Weimer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-01 16:34 UTC by Alfredo Ferrari
Modified: 2016-11-06 00:23 UTC (History)
10 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2016-11-06 00:23:54 UTC


Attachments (Terms of Use)
small c code to show the problem (357 bytes, text/x-csrc)
2016-11-01 16:34 UTC, Alfredo Ferrari
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 20357 None None None 2016-11-02 08:03 UTC

Description Alfredo Ferrari 2016-11-01 16:34:14 UTC
Created attachment 1216166 [details]
small c code to show the problem

Description of problem:
The cosine computed for a specific value is completely wrong, actually the system libraries return the sine!

Version-Release number of selected component (if applicable):
Fedora 24 fully up to date

How reproducible:
Always on whichever Fedora 24 system using gcc, gfortran or g77

Steps to Reproduce:
1.take the short c code (bugcos.c) in attachment...
2... compile and link with gcc -o bugcos -lbsd -lm bugcos.c
3... run bugcos observe the results on the screen

Actual results:
0.9941004006194649

Expected results:
-0.1084637888339666, 0.9941004006194649 is the sine of that angle not the cosine

Additional info:
I could not stress more how serious is this bug. Indeed we found it because it was crashing some complex simulations for LHC here at CERN, however I am afraid that other argument values and not only this one (which is already a big problem if you meet it) could run into similar issues. Please note that fedora 23 is immune, and that moving slightly outside from that argument value makes the cosine suddenly become ok (as you can check printing all 2000 values computed in the attached c code). The problem can be reproduced with g77 (actually we found it initially with g77), gfortran and gcc, ergo it is a system library problem. Again, the consequences of such macroscopic bug are hard to imagine, we were lucky our calculations were full of checks and crashed detecting the anomaly.

Comment 1 Carlos O'Donell 2016-11-01 23:16:58 UTC
I can reproduce this on F24.

I can _not_ reproduce this on F25.

So something was changed, either compiler, binutils, glibc, combination.

Are you able to upgrade to F25?

Are you able to help us narrow down exactly when this changed for you? It would help us narrow down the area we have to look at for changes.

Otherwise I'll have to start a bisect pass between 2.23 and 2.24

Comment 2 Siddhesh Poyarekar 2016-11-02 00:17:20 UTC
I fixed this upstream a couple of months ago, which is how f25 got it:

https://sourceware.org/bugzilla/show_bug.cgi?id=20357

Comment 3 Alfredo Ferrari 2016-11-02 07:13:02 UTC
Hi

I see that the issue has been fixed upstream already. Would it be possible to backport the patch to Fedora 24 or upgrade the F24 glibc ?
To move all out machines to F25 which is still in beta test is not an attractive option, rather are there aby expected drawbacks if we just install the Fedora 25 glibc on Fedora 24 (which anyway will solve the issue for us only)?
Thanks

Comment 4 Florian Weimer 2016-11-02 08:24:52 UTC
(In reply to Siddhesh Poyarekar from comment #2)
> I fixed this upstream a couple of months ago, which is how f25 got it:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=20357

Thanks, I'll backport this to the 2.23 stable branch upstream and Fedora 24.

Comment 5 Fedora Update System 2016-11-02 10:38:39 UTC
glibc-2.23.1-11.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-055349b681

Comment 6 Fedora Update System 2016-11-05 03:32:20 UTC
glibc-2.23.1-11.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-055349b681

Comment 7 Fedora Update System 2016-11-06 00:23:54 UTC
glibc-2.23.1-11.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.