[flang-commits] [flang] [Flang] Add a Fortran Standards Support doc (PR #132195)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Sun Mar 23 03:34:02 PDT 2025
https://github.com/kiranchandramohan updated https://github.com/llvm/llvm-project/pull/132195
>From a0460e711648d6508d6cd628e511b726e4d38fb5 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Thu, 20 Mar 2025 12:05:40 +0000
Subject: [PATCH 1/4] [Flang] Add a Fortran Standards Support doc
---
flang/docs/FortranStandardsSupport.md | 63 +++++++++++++++++++++++++++
flang/docs/index.md | 1 +
2 files changed, 64 insertions(+)
create mode 100644 flang/docs/FortranStandardsSupport.md
diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md
new file mode 100644
index 0000000000000..5261633edc578
--- /dev/null
+++ b/flang/docs/FortranStandardsSupport.md
@@ -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
+
+```{contents}
+---
+local:
+---
+```
+
+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.
+Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023.
+
+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.
+- **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.
+
+## Fortran 77
+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) |
+| 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 |
+| 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
diff --git a/flang/docs/index.md b/flang/docs/index.md
index 1de0ee2e6f0d6..0c92ea9cf7633 100644
--- a/flang/docs/index.md
+++ b/flang/docs/index.md
@@ -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
>From 8499992cc802c3f5a20b4ead7b401d0fa3f10613 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Fri, 21 Mar 2025 12:45:35 +0000
Subject: [PATCH 2/4] Address review comments
---
flang/docs/FortranStandardsSupport.md | 57 +++++++++++++--------------
1 file changed, 28 insertions(+), 29 deletions(-)
diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md
index 5261633edc578..5c960c8680686 100644
--- a/flang/docs/FortranStandardsSupport.md
+++ b/flang/docs/FortranStandardsSupport.md
@@ -1,12 +1,12 @@
-<!--===- docs/FortranStandardsSupport.md
-
+<!--===- 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
+# Flang Fortran Standards Support
```{contents}
---
@@ -14,12 +14,12 @@ local:
---
```
-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.
-Standards support is provided upto Fortran 2008 for now. It will be later extended for Fortran 2018 and Fortran 2023.
+This document summarizes Fortran standards support in Flang. 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.
+Standards support is provided upto Fortran 2008 for now. It will be extended later for Fortran 2018 and Fortran 2023.
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.
+the letters **P**, **Y**, **N** for the implementation status:
- **P** : When the implementation is incomplete for a few cases
- **Y** : When the implementation is complete
- **N** : When the implementation is absent
@@ -27,37 +27,36 @@ the letters **P**, **Y**, **N** for the various implementation status.
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.
-## Fortran 77
-All features are supported.
-
-## Fortran 90
-All features are supported.
+## Fortran 2023
+TBD
-## Fortran 95
-All features are supported.
+## Fortran 2018
+TBD
-## Fortran 2003
+## Fortran 2008
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) |
-| 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 |
-| Asynchronous input/output | P | IO will happen synchronously |
+| 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 2008
+## Fortran 2003
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) |
+| Parameterized Derived Types | P | PDT with length type parameters is not supported. See [Proposal](ParameterizedDerivedTypes.md) |
+| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented |
+| The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented |
+| Asynchronous input/output | P | IO will happen synchronously |
-## Fortran 2018
-TBD
+## FORTRAN 77
+All features are supported.
-## Fortran 2023
-TBD
+## Fortran 90
+All features are supported.
+
+## Fortran 95
+All features are supported.
>From 6c4b380e9737f757c469b6d0881083bdc742a306 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Sun, 23 Mar 2025 02:39:21 +0000
Subject: [PATCH 3/4] Add support tables for Fortran 2023 and Fortran 2018
standards
---
flang/docs/FortranStandardsSupport.md | 62 +++++++++++++++++++++++++--
1 file changed, 58 insertions(+), 4 deletions(-)
diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md
index 5c960c8680686..9dbc3096f42de 100644
--- a/flang/docs/FortranStandardsSupport.md
+++ b/flang/docs/FortranStandardsSupport.md
@@ -28,10 +28,64 @@ Note 1 : No distinction is made between the support in the Parser/Semantics and
Note 2 : Besides the features listed below a few intrinsics like MIN/MAX are not supported for a few cases with CHARACTER type.
## Fortran 2023
-TBD
+See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the
+status of all important Fortran 2023 features.
+
+| Feature | Status | Comments |
+|------------------------------------------------------------|--------|---------------------------------------------------------|
+| Allow longer statement lines and overall statement length | Y | |
+| Automatic allocation of lengths of character variables | N | |
+| The specifiers typeof and classof | N | |
+| Conditional expressions and arguments | N | |
+| More use of boz constants | P | All usages other than enum are supported |
+| Intrinsics for extracting tokens from a string | N | |
+| Intrinsics for Trig functions that work in degrees | N | |
+| Intrinsics for Trig functions that work in half revolutions| N | |
+| Changes to system_clock | N | |
+| Changes for conformance with the new IEEE standard | Y | |
+| Additional named constants to specify kinds | Y | |
+| Extensions for c_f_pointer intrinsic | N | |
+| Procedures for converting between fortran and c strings | N | |
+| The at edit descriptor | N | |
+| Control over leading zeros in output of real values | N | |
+| Extensions for Namelist | N | |
+| Allow an object of a type with a coarray ultimate component to be an array or allocatable | N | |
+| Put with Notify | N | |
+| Error conditions in collectives | N | |
+| Simple procedures | N | |
+| Using integer arrays to specify subscripts | N | |
+| Using integer arrays to specify rank and bound of an array | N | |
+| Using an integer constant to specify rank | N | |
+| Reduction specifier for do concurrent | Y | |
+| Enumerations | N | |
## Fortran 2018
-TBD
+All features except those listed in the following table are supported. Almost all of the unsupported features are related to
+coarrays.
+
+| Feature | Status | Comments |
+|------------------------------------------------------------|--------|---------------------------------------------------------|
+| Asynchronous communication | P | Syntax is accepted |
+| Teams | N | |
+| Image failure | P | stat_failed_image is added |
+| Form team statement | N | |
+| Change team construct | N | |
+| Coarrays allocated in teams | N | |
+| Critical construct | N | |
+| Lock and unlock statements | N | |
+| Events | N | |
+| Sync team construct | N | |
+| Image selectors | N | |
+| Intrinsic functions get_team and team_number | N | |
+| Intrinsic function image_index | N | |
+| Intrinsic function num_images | N | |
+| Intrinsic function this_image | N | |
+| Intrinsic move_alloc extensions | P | |
+| Detecting failed and stopped images | N | |
+| Collective subroutines | N | |
+| New and enhanced atomic subroutines | N | |
+| Failed images and stat= specifiers | N | |
+| Intrinsic function coshape | N | |
## Fortran 2008
All features except those listed in the following table are supported.
@@ -52,11 +106,11 @@ All features except those listed in the following table are supported.
| The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented |
| Asynchronous input/output | P | IO will happen synchronously |
-## FORTRAN 77
+## Fortran 95
All features are supported.
## Fortran 90
All features are supported.
-## Fortran 95
+## FORTRAN 77
All features are supported.
>From 84165a73fb4f68f6234525cddbf26ad4e0539829 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Sun, 23 Mar 2025 10:33:48 +0000
Subject: [PATCH 4/4] Move MIN MAX extension to Fortran 2003 table
---
flang/docs/FortranStandardsSupport.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/flang/docs/FortranStandardsSupport.md b/flang/docs/FortranStandardsSupport.md
index 9dbc3096f42de..df30f4b7ae493 100644
--- a/flang/docs/FortranStandardsSupport.md
+++ b/flang/docs/FortranStandardsSupport.md
@@ -24,8 +24,7 @@ the letters **P**, **Y**, **N** for the implementation status:
- **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.
+Note : No distinction is made between the support in the Parser/Semantics and MLIR or Lowering support.
## Fortran 2023
See [document](F202X.md) for a brief discussion about the new features in Fortran 2023. The following table summarizes the
@@ -105,6 +104,7 @@ All features except those listed in the following table are supported.
| Assignment to allocatable | P | Assignment to whole allocatable in FORALL is not implemented |
| The VOLATILE attribute | P | VOLATILE in procedure interfaces is not implemented |
| Asynchronous input/output | P | IO will happen synchronously |
+| MIN/MAX extensions for CHARACTER | P | Some variants are not supported |
## Fortran 95
All features are supported.
More information about the flang-commits
mailing list