-
Notifications
You must be signed in to change notification settings - Fork 13.5k
fatal error: error in backend: Stack overflow! #16305
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
Comments
I tested the same code with clang's trunk version (3.3) and it is still present. |
We emit an error instead of crashing since Clang 10, but I'm not sure whether this addresses the root of the issue: https://godbolt.org/z/b7djE16Gq
Reduced by C-Reduce: class basic_string {
public:
~basic_string();
};
double atof();
struct InferiorConstraint {
int value;
basic_string name;
};
void stringToInferiorConstraint() {
InferiorConstraint cstr;
cstr.value = atof();
} |
@llvm/issue-subscribers-backend-x86 |
A smaller reproducer is:
https://godbolt.org/z/EjP93EMzj This code should still compile even with sse2 disabled. CC @topperc |
The floating point arguments can only be passed/returned through SSE registers according to 64-bit ABI. So this is not compiler issue but a misuse. |
Which means the diagnostic we issue since 10 is spot-on. Thank you! |
Hmmm, it'd be nicer if we diagnosed this with a more actionable diagnostic; the current diagnostic wording is problematic because it doesn't help the user to correct the issue, it just says "we're doing a thing" with no indication of the actual issue. However, why does |
I agree that there is a room for improvement for wording. It didn't make much sense to me until @phoebewang explained, even though I have high-level understanding of calling conventions and SSE. |
#23119 is an example why users might want to disable SSE on x86_64 (FP arithmetic differences). |
Because
It's not a bug. 64-bit system will enable SSE2 by default. Disable SSE3 won't affect SSE2. |
It seems that GCC handles this code appropriately; better than Clang does (IMO). Given how many bug reports we have around
Ah! So SSE3 does not imply SSE2? I wasn't aware of that (I thought these accumulated the extensions). |
-msse3 implies -msse2 Phoebe was saying you can disable sse3 and leave sse2 enabled. |
I think emitting an error if you use -mno-sse2 and attempt to pass or return a double is entirely reasonable. Really, nobody should be doing that, and spending a bunch of effort on making it work better doesn't seem warranted. Of course the compiler shouldn't crash, though: if we fail to emit an error in some cases today, we should fix that by emitting the proper error. I'd also note that GCC actually silently switches to a non-standard argument-passing ABI if you use -mno-sse on x86-64, which seems like a bad idea. (It emits an error for returns only.) |
Thanks for the discussion (here and on IRC)! I see now that this option is needed for kernels, where the current nonconforming behavior is reasonable so long as we emit an error instead of crashing (which we do). It's unfortunate that it's not a conforming mode, but oh well, not the end of the world -- it suits the needs of the folks who need the option. |
Related: #29774 |
Extended Description
When compiling one of my libraries for the first time with clang, I stumbled across an internal compiler error.
I attached the preprocessed source(s) and associated run script(s), as well as the error trace.
My system is:
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
The text was updated successfully, but these errors were encountered: