summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2007-02-21 22:32:43 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2007-02-21 22:32:43 (GMT)
commitf610f3161bd7ff1d8eb355189f8f7c5a48f17a0d (patch)
tree3cdb82a5226df61982cf88d1348fbd0baa50462c /fortran
parentc831f673c4722c463099d7222671bdcc06072fbe (diff)
downloadhdf5-f610f3161bd7ff1d8eb355189f8f7c5a48f17a0d.zip
hdf5-f610f3161bd7ff1d8eb355189f8f7c5a48f17a0d.tar.gz
hdf5-f610f3161bd7ff1d8eb355189f8f7c5a48f17a0d.tar.bz2
[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
Diffstat (limited to 'fortran')
-rw-r--r--fortran/src/H5test_kind.f9022
1 files 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"