-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)regression 1.12Regression in the 1.12 releaseRegression in the 1.12 release
Description
I've not yet been able to create a minimal reproduction of this that doesn't depend on a private package (sorry), but i can at least start a bisect to try to find the offending commit.
[Edit: better repro in message below]
In a private package, which has a function like
function assign_node_ids(node, starting_id::Int)
ii = starting_id
function _traverse(φ::BackIRType)
new_φ = copy_and_assign_id(φ, ii)
if new_φ !== φ
ii += 1
end
return new_φ
end
_traverse(n) = n
return (_traverse(node), ii)
end
function assign_node_ids(node)
return assign_node_ids(node, 0)[1]
endCalling the function like
node = make_node(...)
assign_node_ids(node)throws
ERROR: UndefVarError: `ii` not defined in local scope
Suggestion: check for an assignment to a local variable that shadows a global of the same name.
Stacktrace:
[1] (::RAI_BackIR.Utilities.var"#_traverse#assign_node_ids##0")(φ::RAI_BackIR.Atom)
@ RAI_BackIR.Utilities ~/repos/raicode/packages/RAI_BackIR/src/Utilities/traversal.jl:104
[2] assign_node_ids
@ ~/repos/raicode/packages/RAI_BackIR/src/Utilities/traversal.jl:113 [inlined]
[3] assign_node_ids(node::RAI_BackIR.Atom)
@ RAI_BackIR.Utilities ~/repos/raicode/packages/RAI_BackIR/src/Utilities/traversal.jl:117
[4] top-level scope
@ REPL[1]:1The error disappears if the function is marked @noinline or the variable isn't renamed in the function, i.e.
@noinline function assign_node_ids(node, starting_id::Int)
ii = starting_id
...
endor
function assign_node_ids(node, ii::Int)
... Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)regression 1.12Regression in the 1.12 releaseRegression in the 1.12 release