Bug 251096
Summary: | Difference in behaviour with compiler-optimised code (-O2) | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | David Campbell <david> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED NOTABUG | QA Contact: | |||||
Severity: | low | Docs Contact: | |||||
Priority: | low | ||||||
Version: | 7 | ||||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2007-08-07 06:56:59 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
David Campbell
2007-08-07 03:56:14 UTC
Created attachment 160796 [details]
bug.c to reproduce the problem
This difference in behaviour is also visible in gcc 2.96 on an old linux. That's caused by excess precision, not a bug, but a thing you need to take into account when programming i?87. See e.g. info gcc --index-search=ffloat-store or e.g. http://www.network-theory.co.uk/docs/gccintro/gccintro_70.html If this is undesirable in your program, you can either use -ffloat-store option which will slow down your program, but ensure every assignment to a double (or float) variable will do the rounding to that precision, or if you have sufficiently new CPU, compile with -msse2 -mfpmath=sse or if you have 64-bit x86_64 CPU, compile 64-bit. |