@@ -602,7 +602,10 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
602
602
Scopes.push_back (GotoScope (
603
603
ParentScope, diag::note_acc_branch_into_compute_construct,
604
604
diag::note_acc_branch_out_of_compute_construct, CC->getBeginLoc ()));
605
- BuildScopeInformation (CC->getStructuredBlock (), NewParentScope);
605
+ // This can be 'null' if the 'body' is a break that we diagnosed, so no
606
+ // reason to put the scope into place.
607
+ if (CC->getStructuredBlock ())
608
+ BuildScopeInformation (CC->getStructuredBlock (), NewParentScope);
606
609
return ;
607
610
}
608
611
@@ -612,7 +615,10 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
612
615
Scopes.push_back (GotoScope (
613
616
ParentScope, diag::note_acc_branch_into_compute_construct,
614
617
diag::note_acc_branch_out_of_compute_construct, CC->getBeginLoc ()));
615
- BuildScopeInformation (CC->getLoop (), NewParentScope);
618
+ // This can be 'null' if the 'body' is a break that we diagnosed, so no
619
+ // reason to put the scope into place.
620
+ if (CC->getLoop ())
621
+ BuildScopeInformation (CC->getLoop (), NewParentScope);
616
622
return ;
617
623
}
618
624
0 commit comments