This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add lcobound and ucobound to the list of intrinsics
ClosedPublic

Authored by ktras on May 31 2022, 2:42 PM.

Details

Summary

Add the coarray intrinsic functions, lcobound and ucobound, to the
list of intrinsics. For both of these functions, add a check to
ensure that if the optional dim argument is present and statically
checkable, its value is in the inclusive range of 1 and the corank
of the coarray argument. In the semantics tests for lcobound and
ucobound, remove the XFAIL directive, add the ERROR directives and
add additional standard-conforming and non-standard conforming
calls.

Diff Detail

Event Timeline

ktras created this revision.May 31 2022, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2022, 2:42 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
ktras requested review of this revision.May 31 2022, 2:42 PM
craig.rasmussen requested changes to this revision.Jun 1 2022, 6:42 PM
craig.rasmussen added inline comments.
flang/test/Semantics/lcobound.f90
10

How about testing for corank>1?

This revision now requires changes to proceed.Jun 1 2022, 6:42 PM
ktras planned changes to this revision.Jun 3 2022, 2:04 PM
ktras added inline comments.
flang/test/Semantics/lcobound.f90
10

I have added some coarrays with a corank>1 to pass to the coarray argument now. In doing so, I discovered that the restriction I tried to add to the dim argument, requiring it to be within the range of the corank doesn't work when the corank is above 1. So I am going back to work on fixing that before I update the patch.

Thanks for the suggestion!

ktras updated this revision to Diff 454917.Aug 23 2022, 12:02 PM
ktras retitled this revision from [flang] Add lcobound to the list of intrinsics and update test to [flang] Add lcobound and ucobound to the list of intrinsics.
ktras edited the summary of this revision. (Show Details)
  • Add ucobound to the list of intrinsics and update the semantics test with the ERROR directives and with more examples of valid and invalid code
  • Add function to ensure that if the optional dim argument is present and statically checkable, its value is in the inclusive range of 1 and the corank of the coarray argument
  • Add more examples of valid and invalid code to the semantics test for lcobound
ktras marked an inline comment as done.Aug 23 2022, 12:03 PM
This revision is now accepted and ready to land.Aug 31 2022, 10:45 AM
ktras added a comment.Sep 1 2022, 12:30 PM

@klausler, @jeanPerier, @PeteSteinfeld Would anyone else like to look this over before I push?

klausler added inline comments.Sep 1 2022, 12:49 PM
flang/lib/Evaluate/intrinsics.cpp
192

It took me several tries to understand the intent here, since the result doesn't depend on the value of the DIM= argument, only its presence, despite the name. Maybe something more self-evident could be used for the name, like "vectorIfNoDim" or "scalarIfDim".

ktras updated this revision to Diff 457401.Sep 1 2022, 2:22 PM

Update name of new enumerator to make its purpose more clear.

ktras added inline comments.Sep 1 2022, 2:25 PM
flang/lib/Evaluate/intrinsics.cpp
192

Thanks @klausler for the feedback. I have updated the name to scalarIfDim to make its purpose more clear.

ktras marked an inline comment as done.Sep 1 2022, 2:26 PM
klausler accepted this revision.Sep 1 2022, 2:27 PM
This revision was automatically updated to reflect the committed changes.