Skip to content

[Flang] Add a Fortran Standards Support doc #132195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 24, 2025
Merged
63 changes: 63 additions & 0 deletions flang/docs/FortranStandardsSupport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!--===- docs/FortranStandardsSupport.md

Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

-->

# Flang's Fortran standards support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Flang's Fortran standards support
# Flang Fortran Standards Support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


```{contents}
---
local:
---
```

This document summarizes Flang's Fortran standards support. The information is only provided as a guideline. The compiler emits
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take the suggested change above, should we also remove 's here? Or just rephrase it to:

This document summarizes Fortran standards support in Flang.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

TODOs/Not Yet Implemented messages for unimplemented features and that should be treated as the authoratative information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This document summarizes Flang's Fortran standards support. The information is only provided as a guideline. The compiler emits
TODOs/Not Yet Implemented messages for unimplemented features and that should be treated as the authoratative information.
This document summarizes Flang's Fortran standards support. The information is only provided as a guideline. The
TODOs/Not Yet Implemented messages emitted by the compiler for unimplemented features should be treated as authoritative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023.
Standards support is provided upto Fortran 2008 for now. It will be extended later for Fortran 2018 and Fortran 2023.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"upto" should be "up to"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed this sentence.


The standards support information is provided as a table with three columns that are self explanatory. The Status column uses
the letters **P**, **Y**, **N** for the various implementation status.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the letters **P**, **Y**, **N** for the various implementation status.
the letters **P**, **Y**, **N** for the implementation status:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- **P** : When the implementation is incomplete for a few cases
- **Y** : When the implementation is complete
- **N** : When the implementation is absent

Note 1 : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support.
Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a list of the intrinsics where support for CHARACTER types is incomplete? If it is not too difficult to identify these, a complete list may be better than alluding to "a few intrinsics".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have a list of intrinsics here. The only ones I am actually aware or the MIN/MAX intrinsic. Since I was not 100% I am making a conservative statement here. Do we want to just say MIN/MAX only? Do you have additional info in the gfortran testsuite?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can check to see if there are any failures as a result of this. I don't know off the top of my head.


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all the contents in the first three sections are the same, I suggest to consolidate to the FORTRAN77, Fortran 90 and Fortran 95 section. In addition, if we take Michael's suggestion to populate the Fortran 2018 and Fortran 2023 sections, I suggest to re-order the sections to start with Fortran 2023 first. I think people are more interested in which newer features that flang support nowadays.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reorganized in descending order of standards. I do not have entries for 2018 and 2023 now. If it is OK, we can add that in subsequent PRs.
I have not consolidated FORTRAN77, Fortran 90 and Fortran 95. I can do so before submitting if there are no reports of unsupported features in this review.

## Fortran 77
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FORTRAN 77 - consistent with what we use in FortranFeatureHistory.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

All features are supported.

## Fortran 90
All features are supported.

## Fortran 95
All features are supported.

## Fortran 2003
All features except those listed in the following table are supported.

| Feature | Status | Comments |
|------------------------------------------------------------|--------|---------------------------------------------------------|
| Parameterized Derived Types | P | PDT with length type is not supported. See [Proposal](ParameterizedDerivedTypes.md) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length type => length type parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented |
| Pointer Assignment | P | Polymorphic assignment in FORALL is not implemented |
| The VOLATILE attribute | P | Volatile in procedure interfaces is not implemented |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volatile => VOLATILE
as it refers to the attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

| Asynchronous input/output | P | IO will happen synchronously |

## Fortran 2008
All features except those listed in the following table are supported.

| Feature | Status | Comments |
|------------------------------------------------------------|--------|---------------------------------------------------------|
| Coarrays | N | Lowering and runtime support is not implemented |
| do concurrent | P | Sequential execution works. Parallel support in progress|
| Internal procedure as an actual argument or pointer target | Y | Current implementation requires stack to be executable. See [Proposal](InternalProcedureTrampolines.md) |

## Fortran 2018
TBD

## Fortran 2023
TBD
1 change: 1 addition & 0 deletions flang/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ on how to get in touch with us and to learn more about the current status.
C++style
DesignGuideline
FortranForCProgrammers
FortranStandardsSupport
GettingInvolved
GettingStarted
ImplementingASemanticCheck
Expand Down