-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[QoI] Cleanup AST after trying to shrink constraint system of invalid expression #6780
Conversation
/cc @rudkx @slavapestov @practicalswift I think it solved all of the |
… expression Since `ConstraintSystem::shrink` is going to attempt to type-check sub-expressions separately it's essential to clean-up AST if constraint generation or solving of the such expressions fails, otherwise if such solving resulted in creation of implicit expression type variables might leak to the outside.
5603c78
to
9b7d632
Compare
@swift-ci Please smoke test |
@xedin Great! I'll take a look once this PR is merged! :-) |
Seems to pass all tests. Merge:able? :-) |
LGTM. I'll hopefully wrap up my side table work soon and a lot of this kind of stuff will go away. |
Thanks, @rudkx! Looking forward to that :) |
This very likely cause a heap-use-after-freen ASAN error on one of our bots. ================================================================= 0x621002d8b874 is located 2932 bytes inside of 4096-byte region [0x621002d8ad00,0x621002d8bd00) previously allocated by thread T0 here: SUMMARY: AddressSanitizer: heap-use-after-free Types.h:413 in swift::CleanupIllFormedExpressionRAII::doIt(swift::Expr*, swift::ASTContext&)::CleanupIllFormedExpression::walkToExprPre(swift::Expr*) |
I will speculatively revert this. |
@aschwaighofer Thanks, I'll submit a separate PR which is not going to use RAII for cleanup, was hoping that I can re-use some of the existing stuff but apparently not :) |
Please let me know how it goes after revert, because solveForExpression uses it exactly the same way and doesn't fail on ASAN... |
Ok, excuse my stupidity, I actually know what the problem is, going to submit separate PR for this shortly. |
ASAN test succeeded after the recert. Followup #6801 also failed in ASAN. |
Since
ConstraintSystem::shrink
is going to attempt to type-checksub-expressions separately it's essential to clean-up AST if constraint
generation or solving of the such expressions fails, otherwise if
such solving resulted in creation of implicit expression type variables
might leak to the outside.