@@ -602,7 +602,10 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
602602 Scopes.push_back (GotoScope (
603603 ParentScope, diag::note_acc_branch_into_compute_construct,
604604 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);
606609 return ;
607610 }
608611
@@ -612,7 +615,10 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S,
612615 Scopes.push_back (GotoScope (
613616 ParentScope, diag::note_acc_branch_into_compute_construct,
614617 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);
616622 return ;
617623 }
618624
0 commit comments