mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 07:09:22 +08:00
70 lines
2.2 KiB
Diff
70 lines
2.2 KiB
Diff
From 09bc016321faca145169fcd0b5a9f871c1b40a6d Mon Sep 17 00:00:00 2001
|
|
From: Luke Robison <108305344+lrbison@users.noreply.github.com>
|
|
Date: Fri, 11 Apr 2025 14:24:09 -0500
|
|
Subject: [PATCH] Fortran configury: Ensure F08 real_kinds are actually valid
|
|
kinds (#5401)
|
|
|
|
Issue: https://github.com/HDFGroup/hdf5/issues/5090
|
|
---
|
|
m4/aclocal_fc.f90 | 24 ++++++++++++++++--------
|
|
1 file changed, 16 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90
|
|
index 9e0dc1d14e8..40d380724fd 100644
|
|
--- a/m4/aclocal_fc.f90
|
|
+++ b/m4/aclocal_fc.f90
|
|
@@ -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
|
|
|
|
@@ -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
|
|
|