-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Sign of zero from differs between CTFE and normal execution (float % float) #102403
Sign of zero from differs between CTFE and normal execution (float % float) #102403
Comments
Reminds me of #55131, though this one's probably less ugly since signs of zeros are less FUBAR than signs of NANs. |
Probably another apfloat bug, either in the LLVM original or in the transpilation? |
To look at LLVM, just feed it through constant folding: https://godbolt.org/z/oWqrhKe4h So it looks like current LLVM APFloat results in negative sign. So this looks like it might be another bug like #100233 (comment) :/ EDIT: you don't need to run any code to see the bug in action, you can trigger it with MIR inlining: https://godbolt.org/z/nYxchqv9P Current output (just the relevant parts):
|
So... basically const prop is unsound around floats? |
The example is a CTFE bug, not a ConstProp bug. |
Using the reproducer from #109567
Yes. ConstProp disagrees with LLVM: https://godbolt.org/z/5dPrfqMYq (once again wishing we could either pin to a nightly in godbolt or otherwise set mir-opt flags in a stable compiler, because this link will eventually not reproduce if we fix this)
With
But with
|
#109567 has some other examples reproducing this. |
While trying to make progress on #113409 I noticed this was showing up as "C++ But, this is not a porting bug, it's a LLVM one, fixed very soon after my port: llvm/llvm-project@f2c2851 My best guess is that LLVM was unaffected by its own bug because the host C EDIT: for the record, I would not have figured this out as easily if not for my WIP fuzzing system: |
I posted a longer update to #55993 (comment) regarding the progress with the whole |
Accidentally closed (overzealous GitHub), my bad. |
With this code:
The assertion fails: compile-time evaluation gives 0.0 while runtime evaluation gives -0.0.
This is probably relevant to tracking issue #57241.
The text was updated successfully, but these errors were encountered: