@@ -122,6 +122,8 @@ constexpr Legality IsLegalBranchTarget(const parser::Statement<A> &) {
122
122
std::is_same_v<A, parser::EndCriticalStmt> ||
123
123
std::is_same_v<A, parser::ForallConstructStmt> ||
124
124
std::is_same_v<A, parser::WhereConstructStmt> ||
125
+ std::is_same_v<A, parser::ChangeTeamStmt> ||
126
+ std::is_same_v<A, parser::EndChangeTeamStmt> ||
125
127
std::is_same_v<A, parser::EndFunctionStmt> ||
126
128
std::is_same_v<A, parser::EndMpSubprogramStmt> ||
127
129
std::is_same_v<A, parser::EndProgramStmt> ||
@@ -210,8 +212,9 @@ class ParseTreeAnalyzer {
210
212
// subprograms. Visit that statement in advance so that results
211
213
// are placed in the correct programUnits_ slot.
212
214
auto targetFlags{ConstructBranchTargetFlags (endStmt)};
213
- AddTargetLabelDefinition (
214
- endStmt.label .value (), targetFlags, currentScope_);
215
+ AddTargetLabelDefinition (endStmt.label .value (), targetFlags,
216
+ currentScope_,
217
+ /* isExecutableConstructEndStmt=*/ false );
215
218
}
216
219
}
217
220
return true ;
@@ -238,18 +241,20 @@ class ParseTreeAnalyzer {
238
241
parser::EndProgramStmt, parser::EndSubroutineStmt>;
239
242
auto targetFlags{ConstructBranchTargetFlags (statement)};
240
243
if constexpr (common::HasMember<A, LabeledConstructStmts>) {
241
- AddTargetLabelDefinition (label.value (), targetFlags, ParentScope ());
244
+ AddTargetLabelDefinition (label.value (), targetFlags, ParentScope (),
245
+ /* isExecutableConstructEndStmt=*/ false );
242
246
} else if constexpr (std::is_same_v<A, parser::EndIfStmt> ||
243
247
std::is_same_v<A, parser::EndSelectStmt>) {
244
248
// the label on an END IF/SELECT is not in the last part/case
245
- AddTargetLabelDefinition (label.value (), targetFlags, ParentScope (), true );
249
+ AddTargetLabelDefinition (label.value (), targetFlags, ParentScope (),
250
+ /* isExecutableConstructEndStmt=*/ true );
246
251
} else if constexpr (common::HasMember<A, LabeledConstructEndStmts>) {
247
- constexpr bool isExecutableConstructEndStmt{true };
248
252
AddTargetLabelDefinition (label.value (), targetFlags, currentScope_,
249
- isExecutableConstructEndStmt);
253
+ /* isExecutableConstructEndStmt= */ true );
250
254
} else if constexpr (!common::HasMember<A, LabeledProgramUnitEndStmts>) {
251
255
// Program unit END statements have already been processed.
252
- AddTargetLabelDefinition (label.value (), targetFlags, currentScope_);
256
+ AddTargetLabelDefinition (label.value (), targetFlags, currentScope_,
257
+ /* isExecutableConstructEndStmt=*/ false );
253
258
}
254
259
return true ;
255
260
}
@@ -826,7 +831,7 @@ class ParseTreeAnalyzer {
826
831
// 6.2.5., paragraph 2
827
832
void AddTargetLabelDefinition (parser::Label label,
828
833
LabeledStmtClassificationSet labeledStmtClassificationSet,
829
- ProxyForScope scope, bool isExecutableConstructEndStmt = false ) {
834
+ ProxyForScope scope, bool isExecutableConstructEndStmt) {
830
835
CheckLabelInRange (label);
831
836
TargetStmtMap &targetStmtMap{disposableMaps_.empty ()
832
837
? programUnits_.back ().targetStmts
@@ -912,7 +917,7 @@ bool InBody(const parser::CharBlock &position,
912
917
return false ;
913
918
}
914
919
915
- LabeledStatementInfoTuplePOD GetLabel (
920
+ static LabeledStatementInfoTuplePOD GetLabel (
916
921
const TargetStmtMap &labels, const parser::Label &label) {
917
922
const auto iter{labels.find (label)};
918
923
if (iter == labels.cend ()) {
0 commit comments