-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
clang, exception raised or not depending on compiler options #3247
Comments
I wasn't able to repro this on clang++ 14: https://godbolt.org/z/99v59KEhb. Likely a compiler issue on the specific compiler version. |
More tests: problem happens on current Arch Linux, when compiled with clang 14.0.6, using libstdc++. |
Does godbolt compile the library using the same options as main source file? |
It doesn't but we can force compilation with the same options using |
To the previous code, I've added
So proper result.
Certainly system lib is somewhat older. Let's switch local git clone to older version, the same as system lib:
Works! Back to git master:
Failure again. So, something happens between these commits.
|
I still think that it could be some compiler error. It happens depending on compiler options used, and only in one exact situation. Generally, works properly in most circumstances. I'll recheck with newer clang (15), but ArchLinux, although bleeding edge as they say, is still on clang14, and I currently have no time budget to fetch and compile all the relevant clang sources. Sometime later. |
Looks like a bug in Lines 779 to 784 in 0f42c17
We could exclude the problematic version(s) of clang there as a workaround, similarly to how we do it for gcc < 12. |
@vitaut @m5k8 Info. |
@vitaut |
Arch Linux distributes libstdc++ within collective gcc-libs: https://archlinux.org/packages/core/x86_64/gcc-libs/ gcc-libs is at version 12.2.0-1 (the same as gcc compiler), libstdc++ is |
In function Lines 330 to 338 in dfbb952
Replace |
And can you test fmt with and without this patch on clang-15? |
After the change - issue is solver and it works properly!
I'll test, but have to install clang15 yet, so results in a moment or more like two moments. |
@m5k8 |
This fixes the issue with clang14. I also have tested with clang15, and it's not needed - previous code (without the above fix) works properly. So it was only clang14 issue. |
Isolated problem -
test.cc
:clang version 14.0.6. Then running compiled executable:
clang++ -I fmt/include -std=c++20 test.cc fmt/src/format.cc
- OKclang++ -I fmt/include -std=c++20 -fomit-frame-pointer test.cc fmt/src/format.cc
- OKclang++ -I fmt/include -std=c++2b test.cc fmt/src/format.cc
- OKclang++ -I fmt/include -std=c++2b -fomit-frame-pointer test.cc fmt/src/format.cc
- runtime exception:clang++ -I fmt/include -std=c++2b -fomit-frame-pointer -O2 test.cc fmt/src/format.cc
- OK again.So the outcome depends on selected C++ standard and compiler options. c++2b and option for omitting frame pointer fails, but adding optimization O2 to this makes it work again.
I'm not competent enough to dig into this problem, not sure whether it's fmt library issue or compiler issue.
gcc is fine with all these variants. MSVC also (albeit options do not apply).
Please advise.
The text was updated successfully, but these errors were encountered: