[flang-commits] [flang] [flang][Semantics] Adding check integer kind on STAT= specifier #230463 (PR #231103)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Mon Oct 12 18:46:39 PDT 2026


================
@@ -63,7 +63,7 @@ ENUM_CLASS(LanguageFeature, BackslashEscapes, OldDebugLines,
     CUDAImplicitDataAttrSpelling, OpenAccDefaultNoneScalarsStrict,
     OpenACCMultipleNamesInRoutine, EnumerationType, CUDAInit,
     PreferIntrinsicModuleUseAssociation, MultipleCommonBlockInit,
-    OutOfBoundsSubscripts)
+    OutOfBoundsSubscripts, StatKind)
----------------
eugeneepshteyn wrote:

(This comment was generated with the help of AI)

This should be a `UsageWarning` ("Portability and suspicious usage warnings") rather than a `LanguageFeature` ("Non-conforming extensions & legacies"): an INTEGER(1) stat-variable is conforming, since 9.7.4 p1 only says "should". As a `LanguageFeature` it is also enabled by `-std=f2018`, so this conforming program now fails `flang -fsyntax-only -std=f2018 -Werror`, where it compiled cleanly before:

```fortran
integer(1) :: s
sync all(stat=s)
end
```

```console
error: Semantic errors in std.f90
std.f90:2:1: warning: The stat-variable must have an integer kind of at least 16-bit
```

`-pedantic` enables `UsageWarning`s as well, so the behavior asked for in the issue is kept. Since the `-W` spelling is derived from the name and becomes user-visible, a more descriptive name than `StatKind` may also be worth considering.

https://github.com/llvm/llvm-project/pull/231103


More information about the flang-commits mailing list