Skip to content

Fortran configury: Ensure F08 real_kinds are actually valid kinds #5401

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 1 commit into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions m4/aclocal_fc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,11 @@ END PROGRAM FC_AVAIL_KINDS
PROGRAM FC08_AVAIL_KINDS
USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stdout=>OUTPUT_UNIT, integer_kinds, real_kinds, logical_kinds
IMPLICIT NONE
INTEGER :: ik, jk, k, max_decimal_prec
INTEGER :: ik, jk, k, kk, max_decimal_prec
INTEGER :: num_rkinds, num_ikinds, num_lkinds
LOGICAL :: found_rkinds( 1:SIZE(real_kinds) )
CHARACTER(LEN=1) :: sep


! Find integer KINDs

Expand All @@ -203,28 +206,33 @@ PROGRAM FC08_AVAIL_KINDS

num_rkinds = SIZE(real_kinds)

! some compilers (ACfL 24) reported REAL=16 kind, but refused to
! compile with it. Verify the kind can be selected in SELECTED_REAL_KIND.
found_rkinds(:) = .FALSE.
max_decimal_prec = 1

prec: DO ik = 2, 36
exp: DO jk = 1, 700
k = SELECTED_REAL_KIND(ik,jk)
IF(k.LT.0) EXIT exp
DO kk = 1,num_rkinds
IF (real_kinds(kk) == k) found_rkinds(kk) = .TRUE.
ENDDO
max_decimal_prec = ik
ENDDO exp
ENDDO prec

sep = ""
DO k = 1, num_rkinds
WRITE(stdout,'(I0)', ADVANCE='NO') real_kinds(k)
IF(k.NE.num_rkinds)THEN
WRITE(stdout,'(A)',ADVANCE='NO') ','
ELSE
WRITE(stdout,'()')
ENDIF
IF(.NOT. found_rkinds(k)) CYCLE
WRITE(stdout,'(A,I0)', ADVANCE='NO') TRIM(sep), real_kinds(k)
sep = ","
ENDDO
WRITE(stdout,'()')

WRITE(stdout,'(I0)') max_decimal_prec
WRITE(stdout,'(I0)') num_ikinds
WRITE(stdout,'(I0)') num_rkinds
WRITE(stdout,'(I0)') COUNT(found_rkinds)

! Find logical KINDs

Expand Down
Loading