-
Notifications
You must be signed in to change notification settings - Fork 1
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
Problem with g++ -Ofast
#189
Comments
Hi Janek, I probably cut a few too many corners in my I will reproduce the bug (if possible) then report.
Thx and great catch! |
I hope you can reproduce it. I just checked and it occurs both for g++ 12.2.0-14 and g++ 14.2.0-14 |
It is all going down fast, let me catch up on It is really good to find this stuff now rather in the general population later. Thx Janek (@cosurgi) |
Hi Janek (@cosurgi) on my WSL2, sadly with Could you tell me some more specifics about your system/PC, etc.? I don't think this thingy will stop the show, but we need to face it rather sooner than later here in this post. Thx Janek! |
Wait, Janek, I got the answer |
Oh you are telling me when you put the lines within the larger context of YADE, then the division becomes non equal to Ah that will be a bit more tricky to reproduce indeed. |
yes. But also initialization is wrong. Search in your browser for strings: 4978165316556861785812770904158242 and 4978165316556861972925864431199324 and you will see. The |
But is the printed number exactly the same as the number you initialized |
I just realized that in summary I have stumbled on two bugs here:
Yes :( I need to wrap my head around this. I don't know if I can write a minimal reproducing example. |
Hi Janek, This one is now clear to me. I ran the backend through our arithmetic tests with
Since our add/sub/mul/div/sqrt (and normalize) require no reordering, Now, thinking out loud here, GCC actually offers a line-by-line Cc: @jzmaddock |
Ugghhh but there will still be potential problems with NaN, infinity and the like.
Cc: @jzmaddock and @mborland |
So if the issue is clear, you no longer need these specifics? But in general I have tried this on
|
Somehow I get the feeling this will creep up from time to time. It feels like publishing non-portable code. But I don't at the moment see a clear pathway to supporting I'm going to keep this issue open for a while and clear my head on this example and play around with it for a while. |
NaN, Inf in general does not work with |
I think we might need full support for something like an unchecked version, easily activate-able. But I have not fully thought through this one yet. |
Yeah. If someone uses |
Closing. Do not use We must state this LOUDLY and CLEARLY in the docs (TODO). |
Hi Chris (@ckormanyos), in our benchmarks in boostorg#648 I was using
-O3
flag till now. I wanted to comparecpp_double_double
withfloat128
when using-Ofast
flag. But I couldn't because I have discovered a bug which caused yade to exit, makingyade -n --quickperformance -j 4
impossible to run.Try this code with g++
quick_test.cpp
:Now look that with flag
-Ofast
the number is wrong:The printed numbers are incorrect for
-Ofast
above. The division in this simple example is correct. But it is even more strange that when I put these exact five lines somewhere in yade:I get this output with
-Ofast
:The printed numbers are correct, but the division is a strange result. Not the one I would get when dividing
0.4978165316556861972925864431199324/0.4978165316556861785812770904158242
because that produces1.00000000000000003758675769660005661
.While compiling yade with the
-O3
gives the correct results:The text was updated successfully, but these errors were encountered: