From f610f3161bd7ff1d8eb355189f8f7c5a48f17a0d Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Wed, 21 Feb 2007 17:32:43 -0500 Subject: [svn-r13373] Problem: Daily tests failed on smirom with g95 Solution: Our algorithm to detect size of Fortran real had a flaw: it didn't work when size of integer was bigger than real; fixed Platforms tested: smirom with g95 and -r8, -i4, -r8 -i4 combinations of compilation flags to set different sizes of integers and real smirom with pgf90 using -i8 flag and without it linew in 32 and 64-bit modes --- fortran/src/H5test_kind.f90 | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/fortran/src/H5test_kind.f90 b/fortran/src/H5test_kind.f90 index 9ef4753..feef616 100644 --- a/fortran/src/H5test_kind.f90 +++ b/fortran/src/H5test_kind.f90 @@ -76,19 +76,25 @@ jr = 0 write(*, "("" subroutine r"" i2.2,""()"")") j write(*,*)" implicit none" - write(*,*)" real :: b" - write(*,*)" integer :: a(8)" + write(*,*)" real :: b(1)" + write(*,*)" integer :: a(1)" write(*,*)" integer :: a_size" - write(*,*)" integer :: b_size" - write(*,*)" a_size = bit_size(a(1))" - write(*,*)" b_size = size(transfer(b,a))*a_size" - write(*,*)" if (b_size .eq. 32) then" + write(*,*)" integer :: real_size" + write(*,*)" integer :: ab_size ! How many integers needed to hold a real" + write(*,*)" integer :: ba_size ! How many reals needed to hold an integer" + write(*,*)" a_size = bit_size(a(1)) ! Size in bits for integer" + write(*,*)" ab_size = size(transfer(b,a))" + write(*,*)" ba_size = size(transfer(a,b))" + write(*,*)" if (ab_size .eq. ba_size) real_size=a_size" + write(*,*)" if (ab_size .gt. ba_size) real_size=a_size*ba_size" + write(*,*)" if (ab_size .lt. ba_size) real_size=a_size/ba_size" + write(*,*)" if (real_size .eq. 32) then" write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_4"" " write(*,*)" endif" - write(*,*)" if (b_size .eq. 64) then" + write(*,*)" if (real_size .eq. 64) then" write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_8"" " write(*,*)" endif" - write(*,*)" if (b_size .eq. 128) then" + write(*,*)" if (real_size .eq. 128) then" write(*,*)" write(*,*) ""#define H5_FORTRAN_HAS_REAL_NATIVE_16"" " write(*,*)" endif" write(*,*)" return" -- cgit v0.12