@@ -1477,8 +1477,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
1477
1477
}
1478
1478
1479
1479
void checkAllocGlobalInst (AllocGlobalInst *AGI) {
1480
+ SILGlobalVariable *RefG = AGI->getReferencedGlobal ();
1481
+ if (auto *VD = RefG->getDecl ()) {
1482
+ require (!VD->isResilient (F.getModule ().getSwiftModule (),
1483
+ F.getResilienceExpansion ()),
1484
+ " cannot access storage of resilient global" );
1485
+ }
1480
1486
if (F.isSerialized ()) {
1481
- SILGlobalVariable *RefG = AGI->getReferencedGlobal ();
1482
1487
require (RefG->isSerialized ()
1483
1488
|| hasPublicVisibility (RefG->getLinkage ()),
1484
1489
" alloc_global inside fragile function cannot "
@@ -1490,6 +1495,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
1490
1495
SILGlobalVariable *RefG = GAI->getReferencedGlobal ();
1491
1496
require (GAI->getType ().getObjectType () == RefG->getLoweredType (),
1492
1497
" global_addr/value must be the type of the variable it references" );
1498
+ if (auto *VD = RefG->getDecl ()) {
1499
+ require (!VD->isResilient (F.getModule ().getSwiftModule (),
1500
+ F.getResilienceExpansion ()),
1501
+ " cannot access storage of resilient global" );
1502
+ }
1493
1503
if (F.isSerialized ()) {
1494
1504
require (RefG->isSerialized ()
1495
1505
|| hasPublicVisibility (RefG->getLinkage ()),
0 commit comments