Fix ICE/AV on string mixin of version=/debug= statements - #23465
Open
AMDphreak wants to merge 1 commit into
Open
Fix ICE/AV on string mixin of version=/debug= statements#23465AMDphreak wants to merge 1 commit into
AMDphreak wants to merge 1 commit into
Conversation
parseStatement returned null for those paths; mixin semantic then dereferenced s.loc in errorSupplemental. Return ErrorStatement instead and guard the supplemental location. Fixes dlang#23464 Co-authored-by: Cursor <cursoragent@cursor.com>
| s = new AST.IfStatement(loc, param, condition, ifbody, elsebody, token.loc); | ||
| else | ||
| s = null; // don't propagate parsing errors | ||
| s = new AST.ErrorStatement; // don't propagate parsing errors as null |
Contributor
There was a problem hiding this comment.
it seems to me that these assignments are redundant with the fixed null checking in statementsem.d
Contributor
There was a problem hiding this comment.
also please use ErrorStatement.get() (requires a rebase)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
version =/debug =(and similar parse paths that returned a nullStatement).parseStatementnow returnsErrorStatementinstead ofnull; mixin semantic null-guards the supplemental location.fail_compilation/mixin_version_debug_assign.d.Fixes #23464
Test plan
mixin("version = foo;")/mixin("debug = 1;")(exit-1073741819/0xC0000005)1with normal diagnosticsmixin_version_debug_assign.d