Skip to content

Commit 9907d24

Browse files
committed
Allow actor isolation in top-level code variables
Don't crash when we're SILGen'ing accesses to globals in top-level code. The address is found in the top-level main function because we generate the initialization code directly. In the case when we're generating the body of the implicit main function, the presence of the address does not indicate that the variable is local.
1 parent 34e42d7 commit 9907d24

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/SILGen/SILGenLValue.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,8 @@ void LValue::addNonMemberVarComponent(SILGenFunction &SGF, SILLocation loc,
28152815
if (!address) {
28162816
address = SGF.emitGlobalVariableRef(Loc, Storage, ActorIso);
28172817
} else {
2818-
assert(!ActorIso && "local var should not be actor isolated!");
2818+
assert((!ActorIso || Storage->isTopLevelGlobal()) &&
2819+
"local var should not be actor isolated!");
28192820
}
28202821
assert(address.isLValue() &&
28212822
"physical lvalue decl ref must evaluate to an address");

0 commit comments

Comments
 (0)