This is an archive of the discontinued LLVM Phabricator instance.

Add semantics unit test for SYNC ALL statement
ClosedPublic

Authored by rouson on Nov 18 2021, 11:29 AM.

Details

Summary

[flang] add semantics test for sync all

Test a range of acceptable forms of SYNC ALL statements,
including combinations with and without the stat-variable
and errmsg-variable present. Also test that several invalid
forms of SYNC ALL call generate the correct error messages.

Diff Detail

Event Timeline

rouson created this revision.Nov 18 2021, 11:29 AM
rouson requested review of this revision.Nov 18 2021, 11:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2021, 11:29 AM
rouson updated this revision to Diff 395771.Dec 21 2021, 4:37 PM

Expand coverage of SYNC ALL statement semantics test:

  1. Add checks for both constraints in the standard.
  2. Check more valid and invalid statement forms.
ktras added inline comments.Feb 3 2022, 9:41 AM
flang/test/Semantics/synchronization01.f90
24

An addition of a sync all statement with the correct type for the errmsg specifier, but the incorrect name of the specifier, as you have done here for sync_status, would be a good addition. Perhaps the incorrect specifier name could be close to the correct one, such as saying errormsg=error_message instead of the correct errmsg=error_message.

rouson updated this revision to Diff 405726.EditedFeb 3 2022, 11:39 AM
  1. Reorganized and regrouped checks.
  2. Increased the coverage of checks for non-standard-conforming code.
ktras requested changes to this revision.Feb 9 2022, 2:54 PM

Please see the inline comment.

flang/test/Semantics/synchronization01.f90
34

The variable non_scalar has not been declared, so the error would be a different one than I believe you are intending to test.

This revision now requires changes to proceed.Feb 9 2022, 2:54 PM
rouson updated this revision to Diff 407347.Feb 9 2022, 4:50 PM

Added required variable declaration.

rouson marked 2 inline comments as done.Feb 9 2022, 4:51 PM
ktras accepted this revision.Feb 10 2022, 10:14 AM

LGTM. The only note is that this test should pass if you take away the XFAIL directive, but doesn't because flang doesn't currently enforce the following constraints stated in the standard: C1171 - that no specifier shall appear more than once in a given sync-stat-list, and C1172 - that a stat-variable or errmsg-variable in a sync-stat shall not be a coindexed object. It seems appropriate to open up an issue on the github repository pointing this out after this commit is pushed, and referencing this test in the issue.

This revision is now accepted and ready to land.Feb 10 2022, 10:14 AM
This revision was automatically updated to reflect the committed changes.

Thanks for working on this, @rouson !

I've just noticed #53915 - thank you for flagging this! LLVM Flang has only recently gained F95 support and I imagine it might be a while (perhaps years) before F18 support is available. It is possible that we won't be re-visiting this in the meantime and once we do come back to this we might find the rationale behind XFAILing this test rather unclear (or hard to track). I think that it would be worth adding a comment that there's no F18 support available yet and hence this test can neither be run nor tested.

Thank you,
-Andrzej

Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 3:05 AM