Error for uninitialized register on asm blocks #5231
Merged
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.
Description
This PR closes #4997. The problem here is that "asm blocks registers" without initializers are considered uninitialized. There is no fallback to "capture" an available variable. This could be easily done, but that would leave us with no obvious syntax for unitialized registers.
With this in mind this PR solves the compiler bug with two diagnostics:
1 - uninitialized registers cannot be read before they are written. This generates an error:
2 - a warning when a unitialized register shadows an available variable with the same name. This is almost for sure a problem, and it is better the name the registe with something else and avoid all the confusion.
Checklist
Breaking*
orNew Feature
labels where relevant.