format with G descriptor




Hi,

The following short program does not produce the expected
output when reading in an integer with a G descriptor.
The last write statement outputs 1.e-7 instead of 1.
Is this a compiler bug, or (most likely) I'm misunderstanding
the use of the G descriptor?


Roman


!-------------------------------------------
program test_format_G
implicit none

character(len=10) s
real r

2 format(g)

s = "1.0"

read(s,*) r
write(*,*) r ! output: 1.000000

read(s,2) r
write(*,*) r ! output: 1.000000


s = "1"

read(s,*) r
write(*,*) r ! output: 1.000000

read(s,2) r
write(*,*) r ! output: 1.0000000E-07 !!!!!!!

stop
end program test_format_G
!-------------------------------------------
.



Relevant Pages

  • Re: non blocking sockets
    ... >> determined that the socket was ready. ... > Upon successful completion, the pselector selectfunction shall ... > arguments to indicate which file descriptors are ready for reading, ... > descriptor shall be considered ready for reading.) ...
    (comp.unix.programmer)
  • Re: non blocking sockets
    ... >> you want to say blocking is or isn't, the standard says it won't. ... arguments to indicate which file descriptors are ready for reading, ... descriptor shall be considered ready for reading.) ...
    (comp.unix.programmer)
  • Re: reading from multiple ports
    ... > Actually the standard says that it won't block. ... > "A descriptor shall be considered ready for reading when a call to ... given to keep nonblocking readability in any moment of time after select ...
    (comp.unix.programmer)
  • [BUG: multiple kernels] data corruption while reading from an USB2 connected HD
    ... usb-storage sporadically loses data while reading ... HD connected via USB 2.0 which practically means that most files stored on ... Interface Descriptor: ...
    (Linux-Kernel)
  • Re: non blocking sockets
    ... >> for reading isn't determined by some unknowable state before ... > But the determination is made while selectis running. ... If something about the descriptor changes after that, ... Well then I don't understand why the standard says what it does. ...
    (comp.unix.programmer)