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 18461 - Do not remove assignments to ambiguous symbols #8015
Conversation
Thanks for your pull request and interest in making D better, @LemonBoy! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
|
src/dmd/backend/gother.c
Outdated
continue; | ||
/* Do not remove assignments to ambiguous values as | ||
* they might be reached trough a pointer */ | ||
if (!(v->Sflags & SFLunambig)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect the bug is elsewhere, as the testbit on b->Boutlv should take into account ambiguous values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable doesn't escape the BB, that's why it's missing from there.
I've pushed another fix that's simpler and hopefully more correct.
Variables may be referenced via OPrelconst beside OPvar, take that into account.
@@ -1488,6 +1488,7 @@ STATIC void accumda(elem *n,vec_t DEAD, vec_t POSS) | |||
vec_free(Pr); vec_free(Dr); | |||
break; | |||
|
|||
case OPrelconst: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is close, but not quite right. The fix is to add a case for OPbt
. I'll work on that tomorrow.
Turns out there was a bit more to fixing it. I rebooted it as #8065 Thank you for identifying where things were going wrong in the optimizer. That's 90% of the work in fixing this problem. This made it easy for me. |
If a value is reached through a pointer don't consider it as definitely
dead.
cc @WalterBright