-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Unexpected output from intel fmt::fprint #3645
Comments
I added the c-library printf call:
And that gives me the "expected" output:
|
I also tried with the
which is worse accuracy. If I loop from 0.345 to 99.345:
The extraneous
And these for
|
Interestingly, the issue doesn't happen with |
Yes, I noticed that. The assembly output is also much cleaner and smaller. |
We found another strangeness:
Returns:
|
Could be related to #3269. |
That is where a git bisect points for me also. |
Although it does it you define |
Maybe @jk-jeon has some insights regarding what might be causing this. |
This is because the rounding criterion is evaluated incorrectly. The cause is that the static data member By the way, compiler explorer is really god send. Who can expect I can debug without even having a compiler. |
It really sounds like a compiler bug: https://godbolt.org/z/9MKsa8xjq. |
So does |
Yes, for the header-only mode. However, we are moving away from it in favor of storing such tables as static constexpr variables in functions which can be applied as a workaround here. In any case, this is a severe bug in the Intel compiler, please report it. |
Thanks, @jk-jeon, for investigating! |
This is EDG frontend and C++ >= 17 bug. |
Potential workaround / restructure for the intel bug that is the cause of fmtlib#3645. Make the variable in the external struct instead an embedded static constexpr variable in the only function that uses the variable.
* Workaround intel bug Potential workaround / restructure for the intel bug that is the cause of #3645. Make the variable in the external struct instead an embedded static constexpr variable in the only function that uses the variable. * Finish the proposed change -- remove struct accessor * Refactor proposed intel fix. Moved variable out of function to avoid specialization on Float. Made it a separate function that is called from format_float. * Fix incorrect function name. * Add missing inline.
* Workaround intel bug Potential workaround / restructure for the intel bug that is the cause of fmtlib#3645. Make the variable in the external struct instead an embedded static constexpr variable in the only function that uses the variable. * Finish the proposed change -- remove struct accessor * Refactor proposed intel fix. Moved variable out of function to avoid specialization on Float. Made it a separate function that is called from format_float. * Fix incorrect function name. * Add missing inline.
With the following program:
I get the expected output on most compiler and lib::fmt version combinations:
However, if I use the intel compiler with either 10.0.0 or trunk, I get:
Notice the
1
at the end of the floating point output. I'm not sure where this is coming from or how to get the same output on intel with 10.0.X as I get with intel and earlier lib::fmt versions or with all other compilers I have tried.Here is a compiler explorer link: https://godbolt.org/z/MzG7T9bfr
The text was updated successfully, but these errors were encountered: