[Bug libfortran/41711] Z format does not support writing KIND=10 reals
dominiq at lps dot ens dot fr
gcc-bugzilla@gcc.gnu.org
Fri Oct 16 08:13:00 GMT 2009
------- Comment #9 from dominiq at lps dot ens dot fr 2009-10-16 08:13 -------
(In reply to comment #8)
> This seems to work. (Although I thought I saw **** once for the z4 value.)
With the following changes
program z
implicit none
integer,parameter :: k8 = selected_real_kind (precision (0.0d0))
integer,parameter :: k = max(k8,selected_real_kind (precision (0.0d0) + 1))
LOGICAL, PARAMETER :: bigend = IACHAR(TRANSFER(1,"a")) == 0
character(16) :: str
real(k) e
integer i
integer(8), dimension(2) :: it
print *, k
call random_seed()
do i=1,100
call random_number(e)
it = transfer(e, it)
if (k==k8) then
write(*,'(E24.17,3X,Z16.16)') e, it(1)
else if (bigend) then
write(str,'(z16.16)') it(1)
write(*,'(E24.17,3X,A,1X,Z16.16)') e, str(33-2*k:16), it(2)
else
write(str,'(z16.16)') it(2)
write(*,'(E24.17,3X,A,Z16.16)') e, str(33-2*k:16), it(1)
end if
end do
end program z
The code works for platforms having REAl(10/16) and with little/big endian-ness
(the Z16.16 format force the printing of the leading zeroes).
Note that ifort detects the spurious ')' in "write(*,'(E24.17,3X,Z4,Z16))')"
(although I think it is not a violation of the standard).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41711
More information about the Gcc-bugs
mailing list