Page MenuHomePhabricator

[flang][OpenMP] Added semantic checks for 'operator' in atomic update assignment statements
Needs RevisionPublic

Authored by NimishMishra on Jun 19 2022, 10:19 PM.

Details

Summary

This patch adds the following semantics check for operator in atomic update statements of the form x = x operator expr and x = expr operator x:

  • "operator must refer to the intrinsic operator and not to a user-defined operator"

Diff Detail

Event Timeline

NimishMishra created this revision.Jun 19 2022, 10:19 PM
Herald added a project: Restricted Project. · View Herald Transcript
NimishMishra requested review of this revision.Jun 19 2022, 10:19 PM
peixin requested changes to this revision.Jun 20 2022, 4:32 AM
peixin added inline comments.
flang/lib/Semantics/check-omp-structure.cpp
1546

It seems that you can support this semantic check all in here.

flang/test/Semantics/OpenMP/omp-atomic-user-defined-operators.f90
45

This is not a valid atomic update statement since * is not one intrinsic operator in this case.

This revision now requires changes to proceed.Jun 20 2022, 4:32 AM
NimishMishra added inline comments.Jul 11 2022, 7:26 AM
flang/test/Semantics/OpenMP/omp-atomic-user-defined-operators.f90
45

Yes. Do you have any idea on dealing with overloaded intrinsic operators? One way could be to do something with typed expressions; but in case you have some idea, do share.