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
fix Issue 24026 - ImportC: ICE on nested C initializer 2 #15375
Conversation
Thanks for your pull request, @WalterBright! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + dmd#15375" |
I tried compiling the C library that found this bug with this PR, and there's still errors: typedef struct {
struct {
char data[24];
};
int length;
} ES;
ES empty = {{.data = {0}}, .length = 0};
Do you want me to open a new bugzilla issue for that? |
Another test case: typedef struct {
int k;
struct {
struct {
struct {
int s;
} f;
};
};
} SH;
SH data = (SH) {
.k = 0,
{{.f = {.s = 0}}}
};
|
This baffles me. The failing test case works fine on my Ubuntu machine. Also, the new test cases are all part of the same problem, so no need to add them to the bugzilla issue. |
To clarify, I got those error messages when compiling with dmd built from this PR, so either those are different, or this PR doesn't fix the problem properly. |
When I run the test, I get this warning:
I think the problem is that there's a symbol conflict in the delegates dmd creates for expression statements, since GNU assert() uses expression statements. #include <assert.h>
void test23768()
{
assert(3);
assert(4); // emitted as __dgliteral3
}
void test24026()
{
int x = 3;
assert(x == 3); // also emitted as __dgliteral3
}
int main()
{
test23768();
test24026();
return 0;
} To work around it, perhaps use |
Filed: Issue 24029 - ImportC: symbol name clash on statement expressions |
@dkorpel wow, nice catch. I never thought of that. You've saved me a lot of debugging effort! |
Shall I rebase this to stable and merge or are you going to fix the failing cases (#15375 (comment), #15375 (comment)) in this PR? |
Yes, since it is a regression. (I changed my mind.)
Yes, but as a separate PR. Should have a separate bugzilla for them, too. I can do that if you prefer. |
Hmm, I can't check out this PR for some reason
|
The PR is small enough it can just be cut&pasted into a new PR. |
2b23a9b
to
9713e34
Compare
Follow up issue filed: Issue 24031 - ImportC: DMD Rejects valid nested C initializers |
@dkorpel thanks! |
No description provided.