[flang-commits] [flang] [llvm] [flang] [flang-rt] Implement AT edit descriptor for Fortran 202X with appropriate handling and tests (PR #189157)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Fri Apr 10 12:52:18 PDT 2026
================
@@ -0,0 +1,40 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
+! Test AT edit descriptor (Fortran 202X)
+
+ character(10) :: str
+ character(kind=2,len=10) :: str2
+ character(kind=4,len=10) :: str4
+
+ ! Valid: AT with WRITE
+ write(*, '(AT)') 'hello'
+ write(*, '(AT)') str
+ write(*, '(2AT)') 'abc', 'def'
+
+ ! Valid: AT with non-default character kinds
+ write(*, '(AT)') str2
+ write(*, '(AT)') str4
+ write(*, '(2AT)') str2, str4
+
+ ! Valid: AT in FORMAT statement for WRITE
+1 format(AT)
+ write(*,1) 'hello'
+
+ ! Error: AT must not be used for input
+ !ERROR: 'AT' edit descriptor must not be used for input
+ read(*, '(AT)') str
+
+ ! Error: AT must not be used for input with non-default kinds
+ !ERROR: 'AT' edit descriptor must not be used for input
+ read(*, '(AT)') str2
+ !ERROR: 'AT' edit descriptor must not be used for input
+ read(*, '(AT)') str4
+
+ ! AT does not accept a width
+ !ERROR: 'AT' edit descriptor does not accept a width value
+ write(*, '(AT10)') str
+
----------------
eugeneepshteyn wrote:
Please also add a test for something like `AT10.2`. Should this be an error, or ignore it?
https://github.com/llvm/llvm-project/pull/189157
More information about the flang-commits
mailing list