[PATCH] D92735: [Flang] [OpenMP] Add semantic checks for invalid branch into/from OpenMP constructs

Praveen G via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 00:16:09 PST 2021


praveen added a comment.

@kiranchandramohan @sameeranjoshi

I tried to make use of the **CheckBranchesIntoDoBody** function, but since it involves the use of multiple functions and types defined in //resolve-labels.cpp// such as using //**ProxyForScope**//, **//LabeledStatementInfoTuplePOD//**, //**SourceStatementInfoTuplePOD**// and also the labels, scopes and other details are being identified as part of the walk in //ParseTreeAnalyzer// class, it would be more complex to reuse these functions.

Hence I have retained the logic to identify the invalid entry to OpenMP structured blocks in resolve-directives.cpp and added the checks for all the statements involving labels as in 'LabelEnforce' class except //AssignStmt//.

void LabelEnforce::Post(const parser::AssignStmt &);
The check involving AssignStmt in LabelEnforce may not be suitable as part of the control flow checks for OpenMP constructs.

  integer :: b
  !$omp parallel
  assign 5 to b
  !$omp end parallel
  
  5 print *, 5

In the above example, we detect this as an error as part of the 'LabelEnforce' check.

Can we make use of the function **CheckLabelContext** added as part of this change itself to check the control flow escaping the OpenMP constructs ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92735/new/

https://reviews.llvm.org/D92735



More information about the llvm-commits mailing list