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

[SR-11396] enabling optimization on linux changes the value of sinh #53797

Open
marcrasi mannequin opened this issue Aug 30, 2019 · 5 comments
Open

[SR-11396] enabling optimization on linux changes the value of sinh #53797

marcrasi mannequin opened this issue Aug 30, 2019 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself optimized only Flag: An issue whose reproduction requires optimized compilation standard library Area: Standard library umbrella

Comments

@marcrasi
Copy link
Mannequin

marcrasi mannequin commented Aug 30, 2019

Previous ID SR-11396
Radar None
Original Reporter @marcrasi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler, Standard Library
Labels Bug, OptimizedOnly
Assignee None
Priority Medium

md5: da5e338ccba0b59f99144cdbf8db658e

Issue Description:

marcrasi@marcrasi:~/Downloads/swift-toolchains/swift-5.0.2-RELEASE-ubuntu18.04$ cat marc.swift
import Glibc
print(sinh(Float(0.375)))
marcrasi@marcrasi:~/Downloads/swift-toolchains/swift-5.0.2-RELEASE-ubuntu18.04$ usr/bin/swift marc.swift
0.38385105
marcrasi@marcrasi:~/Downloads/swift-toolchains/swift-5.0.2-RELEASE-ubuntu18.04$ usr/bin/swift -O marc.swift
0.38385108 

As you can see from the path, this is happening on swift-5.0.2-RELEASE-ubuntu18.04.

We have experimented with a few additional configurations:

  • (MacOS) Swift version 5.1-dev (LLVM 200186e28b, Swift aa4fd59) (x86_64-apple-darwin18.7.0): Issue does not occur. ("import Darwin" instead of "import Glibc")

  • (Linux) Swift version 5.1-dev (LLVM b47beb8a70, Swift e90298c) (x86_64-unknown-linux-gnu): Issue does occur.

@belkadan
Copy link
Contributor

@stephentyrone, any hypotheses?

@belkadan
Copy link
Contributor

Note the "only on the 5.0 branch" part.

@marcrasi
Copy link
Mannequin Author

marcrasi mannequin commented Aug 30, 2019

Not "only on the 5.0 branch," it happens on 5.1 on Linux too. It's only MacOS that's not doing this.

@stephentyrone
Copy link
Member

I believe that this is compile-time evaluation vs. run-time, which suggests that different implementations of `sinh` are being invoked without being in a cross-compile situation. How does the swift build on linux link against libm?

@belkadan
Copy link
Contributor

Oops, I mentally inserted a "not" where there wasn't one, my bad.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself optimized only Flag: An issue whose reproduction requires optimized compilation standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants