Skip to content
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

Floating point constants are not deterministic across platforms #25233

Open
EdSchouten opened this issue Sep 17, 2015 · 1 comment
Open

Floating point constants are not deterministic across platforms #25233

EdSchouten opened this issue Sep 17, 2015 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen floating-point Floating-point math

Comments

@EdSchouten
Copy link
Contributor

Bugzilla Link 24859
Version trunk
OS All
Attachments Tarball with testcase and output
CC @DimitryAndric

Extended Description

If I install exactly the same version of Clang (3.7.0-RELEASE) on Mac OS X, FreeBSD and Linux, all targeting the same platform (x86_64-unknown-cloudabi) and build the same source file at different optimization levels, I get different results. This bug is similar in nature to bug 24734, but the root cause is different. My suspicion is that this is related to FPU rounding modes.

Attached is a tarball that contains a C source file, foo.c, that is a reduced testcase based on libspeex's vbr.c. This testcase has been built on Mac OS X, FreeBSD and Linux, using different optimization modes. As you can see, anything above -O0 yields different results.

@EdSchouten
Copy link
Contributor Author

This bug still applies to r269024.

Some more debugging has revealed that this is due to log() being called. If I compile the code with -fno-builtin or change the calls to log() to, say, banana(), the generated output becomes identical again.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@arsenm arsenm added the floating-point Floating-point math label Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:codegen floating-point Floating-point math
Projects
None yet
Development

No branches or pull requests

2 participants