Fix compiler crash when evaluating null-conditional assignment to splattable value-type#2437
Merged
Merged
Conversation
Collaborator
|
A bug report and ALSO a fix at the same time? I love it! |
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.
This PR fixes a crash during code-gen when using a splattable struct in a null-conditional assignment.
The crash can be reproduced with this code:
In debug builds of the IDE, this produced the following error message:
The problem is that if the value that is assigned through the null-conditional is splattable, a splat might be passed to
BfModule::FlushNullConditional. In there,result = LoadValue(result);returns the splat-head unchanged, which causes a type mismatch in the store operation that is created later: the type of the target will be a pointer to the entire struct (in this caseStringView*) while the source pointer will just be the splat-head (in this casei8*).CreateAlignedStoredoesn't check the types, but the backend does, which then crashes.The fix is to use
LoadOrAggregateValueinstead ofLoadValue. If necessary, this will aggregate the splat, so we use the correct value and thus type for the store operation.