This is an archive of the discontinued LLVM Phabricator instance.

[Flang] [OpenMP] Add semantic check for OpenMP private ,firstprivate and lastprivate clauses
ClosedPublic

Authored by praveen on Dec 14 2020, 7:09 AM.

Details

Summary

OpenMP 4.5 - Variables that appear in expressions for statement function definitions may not appear in private, firstprivate or lastprivate clauses.

Test case : omp-private03.f90

Diff Detail

Event Timeline

praveen created this revision.Dec 14 2020, 7:09 AM
praveen requested review of this revision.Dec 14 2020, 7:09 AM
Herald added a project: Restricted Project. · View Herald Transcript
praveen added a comment.EditedDec 14 2020, 7:13 AM

"Variables that appear in namelist statements, in variable format expressions, or in expressions for statement function definitions, may not appear in a firstprivate clause."

@kiranchandramohan I was not able to find the implementation for the "variable format expressions" . Do we have support for this part ?

LGTM.

"Variables that appear in namelist statements, in variable format expressions, or in expressions for statement function definitions, may not appear in a firstprivate clause."

@kiranchandramohan I was not able to find the implementation for the "variable format expressions" . Do we have support for this part ?

I believe "variable format expressions" are not supported so we can skip this check,

This revision is now accepted and ready to land.Dec 23 2020, 3:19 PM
This revision was landed with ongoing or failed builds.Dec 25 2020, 1:21 AM
This revision was automatically updated to reflect the committed changes.
flang/lib/Semantics/resolve-directives.cpp
237

We have an ordering issue here. OmpAttributeVisitor (this class) is called as part of resolvenames which happens before the parse-tree rewrite. Problem is that before the parse-tree rewrite there are array expressions which are mis-parsed as statement functions. So this function will be called on a lot of statement functions which are not actually statement functions and can cause problems.