This is an archive of the discontinued LLVM Phabricator instance.

[flang]Verify C7107, C7108, C7109 from - Clause 7 constraint checks for f18.
ClosedPublic

Authored by sameeranjoshi on Jul 24 2020, 3:13 AM.

Details

Summary
  1. Annotate the sources with constraint numbers.
  2. Add tests for

    *C7107 (R765) digit shall have one of the values 0 or 1. *C7108 (R766) digit shall have one of the values 0 through 7. *C7109 (R764) A boz-literal-constant shall appear only as a data-stmt-constant in a DATA statement, or where explicitly allowed in 16.9 as an actual argument of an intrinsic procedure.

Diff Detail

Event Timeline

sameeranjoshi created this revision.Jul 24 2020, 3:13 AM
sameeranjoshi marked an inline comment as done.Jul 24 2020, 4:20 AM
sameeranjoshi added inline comments.
flang/test/Semantics/boz-literal-constants.f90
35

Seems like this 8.6.7(11) was missing a test.
Current llvm-trunk flang outputs below error:

"DATA statement value could not be converted to the type 'COMPLEX(4)' of the object 'rescmplx'"

Is the error (with this patch) expected to be printed here(i.e is that getting ignored due to above error)?

49

Is error below a more proper one?

Typeless (BOZ) not allowed for both 'i=' & 'j=' arguments.

16.9.65(3)

J shall be of type integer or a boz-literal-constant. If both I and J are of type integer, they shall have the same kind type parameter. I and J shall not both be boz-literal-constants

restricts variables I and J when both are boz-literal-constants, whereas the current error with flang trunk assumes 'i' to be wrong, and which might not give proper information to the user.

PeteSteinfeld requested changes to this revision.Jul 24 2020, 7:18 AM

Thanks for working on this!

Please update the messages and the test results. Also, please add a reference to C7109 in the source code where that constraint is enforced.

flang/test/Semantics/boz-literal-constants.f90
35

I suspect that the error message produced in this instance changed when I committed the fix for D83917. In that change, I give the normally typeless BOZ literal constants the type INTEGER. The new error message seems OK to me, but you should update the test results.

49

I would say:

Typeless (BOZ) not allowed for either 'i=' & 'j=' arguments.
This revision now requires changes to proceed.Jul 24 2020, 7:18 AM
sameeranjoshi edited the summary of this revision. (Show Details)

Address review comments.

Herald added a project: Restricted Project. · View Herald TranscriptJul 24 2020, 11:04 AM

Add missing constraint number in sources.

sameeranjoshi marked 3 inline comments as done.Jul 24 2020, 11:12 AM
PeteSteinfeld requested changes to this revision.Jul 24 2020, 11:49 AM
PeteSteinfeld added inline comments.
flang/lib/Evaluate/intrinsics.cpp
1134 ↗(On Diff #280523)

Sorry for not noticing this earlier, but the message should say:

Typeless (BOZ) not allowed for either '%s=' or '%s=' arguments
flang/test/Semantics/boz-literal-constants.f90
50

The message also needs to be corrected here.

This revision now requires changes to proceed.Jul 24 2020, 11:49 AM
Harbormaster completed remote builds in B65601: Diff 280522.
tskeith added inline comments.
flang/test/Semantics/boz-literal-constants.f90
49

I think @sameeranjoshi's version of this message is right. They can't both be BOZ literals but either one can be.

PeteSteinfeld added inline comments.Jul 24 2020, 12:47 PM
flang/test/Semantics/boz-literal-constants.f90
49

Good catch, Tim. I just re-read the standard, and you're correct.

sameeranjoshi marked 4 inline comments as done.

Revert to older message.

sameeranjoshi edited the summary of this revision. (Show Details)Jul 27 2020, 9:44 AM
PeteSteinfeld accepted this revision.Jul 27 2020, 1:07 PM

All builds, tests, and looks good!

This revision is now accepted and ready to land.Jul 27 2020, 1:07 PM

Changes in commit message for using arc.

This revision was landed with ongoing or failed builds.Jul 31 2020, 11:15 AM
This revision was automatically updated to reflect the committed changes.