-
Notifications
You must be signed in to change notification settings - Fork 94
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
Loop with break
or continue
at top level but not last statement fails validation
#323
Comments
Handling unreachable code is lacking some support here indeed. We should probably end the first basic block with |
This was referenced May 15, 2024
bcardosolopes
pushed a commit
that referenced
this issue
Jun 6, 2024
Without this patch, CIR CodeGen continue to generate in the same block after `cir.break` and `cir.continue`, which would cause verification error because `cir.break` and `cir.continue` should appear at the end of blocks. This patch creates a new dangling block after generating `cir.break` and `cir.continue` to fix the issue. This will fix #323.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a
for
,while
, ordo
/while
loop contains abreak
orcontinue
statement at the top level of the loop's body, and thebreak
orcontinue
statement is not the last statement in the block, then ClangIR fails validation.If the
break
orcontinue
is in a nested scope within the loop (which is the normal case in real code), there is no error. If thebreak
orcontinue
statement is the last statement in the block then there is a different internal error which is covered by #324.The text was updated successfully, but these errors were encountered: