This is an archive of the discontinued LLVM Phabricator instance.

[flang][runtime] Support L editing of Logical
ClosedPublic

Authored by sunshaoce on Mar 27 2023, 10:26 AM.

Diff Detail

Event Timeline

sunshaoce created this revision.Mar 27 2023, 10:26 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
sunshaoce requested review of this revision.Mar 27 2023, 10:26 AM

The "Lw" edit descriptor already works in Flang. A bare "L" edit descriptor is an extension which you'll need to document. Also please ensure with tests that a bare "L" edit descriptor can be used in a FORMAT statement.

Please test with "L" embedded in a CHARACTER that is used as a format.

The extensions document is flang/docs/Extensions.md

Address comments. Thanks!

sunshaoce updated this revision to Diff 508933.Mar 28 2023, 1:41 AM

Modify test

Thanks @sunshaoce for the patch. I have a comment about the location of the test.

flang/test/Driver/print-logical.f90
3 ↗(On Diff #508933)

Execution tests are not put in the flang/test/Driver directory.

If you want to test execution then the best places are:

  1. https://github.com/llvm/llvm-project/tree/main/flang/unittests/Runtime
  2. https://github.com/llvm/llvm-test-suite/tree/main/Fortran/UnitTests

Please look at similar tests in this area.

sunshaoce updated this revision to Diff 509052.Mar 28 2023, 9:39 AM
sunshaoce marked an inline comment as done.

Add a unittest

Does this extension work with any other Fortran compiler?

Does this extension work with any other Fortran compiler?

It seems that IFX and IFORT can only format logical types. For pgfortran, if someone can help test, it would be much appreciated.

klausler accepted this revision.Apr 5 2023, 9:51 AM

Does this extension work with any other Fortran compiler?

It seems that IFX and IFORT can only format logical types. For pgfortran, if someone can help test, it would be much appreciated.

It works for GNU Fortran, the Intel compilers, nvfortran, and XLF. It does not work with NAG. So it's worth doing.

This revision is now accepted and ready to land.Apr 5 2023, 9:51 AM

The 22.1 version of nvfortran worked for logicals and integers. It did not work for strings and reals.
gfortran's and nvfortran's interpretation of integers seems to be different for the L format.

BTW, thanks for moving the test to unittests/Runtime/LogicalFormatTest.cpp.

This revision was automatically updated to reflect the committed changes.