Looking only at F2008 (N2122) there were a minimum of 16 of this sort of “breaking changes”. Here’s a couple of them pulled directory from the doc:
- In the first paragraph of the subclause, before C1505 add a new constraint:
C1504a (R425) A derived type with the BIND attribute shall have at least one component.
- Subclause 5.2.1: Add new constraint:
C507a An expression that specifies a length type parameter or array bound of a named constant shall be a constant expression.
- After constraint C427 insert new constraint:
C427a (R426) The same type-param-name shall not appear more than once in a derived-type-stmt.
- After constraint C4106, insert the following new constraint:
C4106a (R472) The declared type of an ac-value shall not be abstract.
…etc…etc
That first one is a great example - C1504a, is now C1805. And Derived Types with the BIND attribute was further restricted again in F2023 with C1806. So there’s two such “breaking changes” to a single feature in as many releases of the standard. These such things are not rare - they are plentiful.
Because J3 defines a standards-compliant processor as meeting a certain criteria, and the Flang project wants to deliver a viable alternative to other Fortran compilers.
Yes! That is exactly my point, and its why Flang should be accepting of expanding the existing -std= flag to include -std=f2023 as a user option since it is the one and only choice we have for preserving legacy code functionality while also allowing Flang to be a standards-compliant Fortran processor for new development.
NAG, GNU and Intel all have a flag to specify the standard version a user chooses to adhere to.
Here’s what GNU does for this specific issue with the intrinsic in question. This is, to me, a demonstration of the very definition of “preserving existing investments”.
$ cat system_clock.f90
program p
integer(8) :: c8, r8, m8
integer(4) :: c4, r4, m4
integer(2) :: c2, r2, m2
call system_clock(c8, r8, m8)
print '(i5,3i22)', 8, r8, m8, c8
call system_clock(c4, r8, m8)
print '(i5,3i22)', 8, r8, m8, c4
call system_clock(c2, r8, m4)
print '(i5,3i22)', 8, r4, m4, c2
end
$ gfortran -std=f2018 system_clock.f90
$ gfortran -std=f2023 system_clock.f90
system_clock.f90:8:24:
8 | call system_clock(c4, r8, m8)
| 1
Error: Prohibited in Fortran 2023: integer arguments to SYSTEM_CLOCK at (1) with different kind parameters
system_clock.f90:11:20:
11 | call system_clock(c2, r8, m4)
| 1
Error: Prohibited in Fortran 2023: COUNT argument to SYSTEM_CLOCK at (1) with kind smaller than default integer
This is more than just a SYSTEM_CLOCK intrinsic issue, as the D97119 PR brings up (thanks for the pointer to that, Steve). This particular RFC is about having a way for developers to being adding features from a new version of the standard (or an interp, or a corrigendum, or finalized F202y features coming 12 months from now) and allowing users to meet some arbitrary standard requirement and to specify it across their entire project (LLVM C++20, anyone?).