-
Notifications
You must be signed in to change notification settings - Fork 68
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 cycle removal bugs #441
Conversation
The `i` index in the outermost loop over the nodes would become shadowed by the `i` index in the inner loop over the cycle indices, so the check to exit early would be done against the wrong variable.
Thanks for fixing this. Did it solve #440 as well? |
No unfortunately, I'm still looking into that. My current suspicion is that there's something going wrong with the cycle detection 🤔 Just for my own information, am I correct in thinking that typedef struct Bar;
struct Foo {
Bar* bar;
};
struct Bar {
Foo foo; // Could also be a pointer
} |
Yes. I'm now trying to reduce the header to an MWE. |
MWE:
|
With this PR:
|
The simplified MWE works, but it's not equivalent to your original MWE which still fails for me. I think this is an equivalent MWE: typedef struct A A;
typedef struct B B;
typedef struct C C;
struct B;
struct C;
struct B
{
B* x;
};
struct C
{
B y[10];
};
typedef struct vector_C
{
C* c;
} vector_C;
typedef struct pool_C
{
vector_C vc;
} pool_C;
struct A
{
pool_C pc;
C* c;
}; |
Ok, I stepped through That would explain the output:
It's considering |
62c9917 fixes the issue for me 😅 |
The
i
index in the outermost loop over the nodes would become shadowed by thei
index in the inner loop over the cycle indices, so the check to exit early would be done against the wrong variable.I don't have an example of this failing, I was just reading the code and figured that it was probably a bug. Unfortunately I'm not familiar enough with the code to write a test for it.