Skip to content

Commit

Permalink
Merge pull request #49397 from JuliaLang/kf/verifycontrol
Browse files Browse the repository at this point in the history
irverify: Catch invalid use of Goto{IfNot, Node}, ReturnNode
  • Loading branch information
staticfloat authored Apr 18, 2023
2 parents 386b09f + 7c80f25 commit 1512d6f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/compiler/ssair/verify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function check_op(ir::IRCode, domtree::DomTree, @nospecialize(op), use_bb::Int,
error("")
end
end

use_inst = ir[op]
if isa(use_inst[:inst], Union{GotoIfNot, GotoNode, ReturnNode})
@verify_error "At statement %$use_idx: Invalid use of value statement or terminator %$(op.id)"
error("")
end
elseif isa(op, GlobalRef)
if !isdefined(op.mod, op.name) || !isconst(op.mod, op.name)
@verify_error "Unbound GlobalRef not allowed in value position"
Expand Down

0 comments on commit 1512d6f

Please sign in to comment.