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

esp32s3 miscompilation (with lto = false) #186

Closed
dimpolo opened this issue Jul 18, 2023 · 2 comments
Closed

esp32s3 miscompilation (with lto = false) #186

dimpolo opened this issue Jul 18, 2023 · 2 comments

Comments

@dimpolo
Copy link

dimpolo commented Jul 18, 2023

I tried this code:

repo: https://github.com/dimpolo/miscompile
relevant code: https://github.com/dimpolo/miscompile/blob/cc4b61b113115887343097f9ba7df3f8ed0e9556/src/main.rs#L32-L45

cargo run
cargo run --release

I expected to see this happen:
adding --release should not make a difference

Instead, this happened:

 > cargo run
-0.5732682
-0.57328224
-0.57328206
-0.5732818
-0.57328165
-0.5732814
-0.5732812
-0.573281
-0.5732808
-0.57328063
...

 > cargo run --release
0.5732682
1.7202483
4.0127697
8.573706
17.47281
33.58494
56.554703
76.10143
85.23757
88.43065
...

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (4ca000ac8 2023-07-13) (1.71.0.1)
binary: rustc
commit-hash: 4ca000ac85a4f486ed080c281c86ea2287592027
commit-date: 2023-07-13
host: x86_64-pc-windows-msvc
release: 1.71.0-nightly
LLVM version: 16.0.4

Sorry this isn't very minimized, but the linked repo should be a good enough starting point

@MabezDev
Copy link
Member

Your repo links 404 for me. Is it a duplicate of #180 perhaps?

@dimpolo
Copy link
Author

dimpolo commented Jul 19, 2023

Sorry, forgot to set it to public.
Reading through that issue this is quite likely a duplicate.
Adding rustflags = [..., "-C", "target-feature=-fp"] solved my issue.
Might I suggest to update the name of #180 to something like "miscompilation of hardware float multiplication"?

@dimpolo dimpolo closed this as completed Jul 19, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants