% cat rwinfnan1.f
      character*50 line
      real arg, s, x, nan, inf
      logical isnan, ispinf, isninf

      isnan(arg)  = (arg .ne. arg)
      isninf(arg) = (arg .eq. -inf)
      ispinf(arg) = (arg .eq. inf)

      open (unit = 1, file='rwinfnan.tmp',
     x     access = 'sequential', form = 'formatted')

      s = 0.0
      x = s
      inf = 1.0/s
      nan = x/s

      write (1,*) nan
      write (1,*) inf

      rewind (1)
      read (1,'(a)') line
      write (6,*) 'NaN was written as: ', line
      read (1,'(a)') line
      write (6,*) 'Inf was written as: ', line

      rewind (1)
      read (1,*) x
      if (isnan(x)) then
           write (6,*) 'NaN was correctly input'
      else
           write (6,*) 'NaN was INCORRECTLY input as ', x
      endif

      read (1,*) x
      if (x .eq. x) then
           write (6,*) 'Inf was correctly input'
      else
           write (6,*) 'Inf was INCORRECTLY input as ', x
      endif

      end
========================================================================
Apple PowerMac G3 (267 MHz);    GNU/Linux 2.2.18-4hpmac

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NAN
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
========================================================================
Apple PowerMac G3 (267 MHz);   Yellow Dog GNU/Linux  2.4.10-12a

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NAN
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
========================================================================
Apple Power Macintosh (233 MHz);           GNU/Linux 2.2.15pre9

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NAN                                             
 Inf was written as:   INF                                             
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
========================================================================
Compaq AlphaServer DS20 Sierra/667 (EV?? 21264 CPU, 667 MHz, ????MB RAM); OSF/1 5.0

% f77 -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /uufs/inscc.utah.edu/common/home/mthnhb/rwinfnan.tmp
   0: __FINI_00_remove_gp_range [0x3ff81a6c374]
   1: __FINI_00_remove_gp_range [0x3ff81a6c8f4]
   2: __FINI_00_remove_gp_range [0x3ff81a94e68]
   3: __FINI_00_remove_gp_range [0x3ff81a94538]
   4: main$rwinfnan_ [rwinfnan1.f: 27, 0x120001dd0]
   5: main [for_main.c: 203, 0x120001a94]
   6: __start [0x120001a08]

% f90 -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /uufs/inscc.utah.edu/common/home/mthnhb/rwinfnan.tmp
   0: __FINI_00_remove_gp_range [0x3ff81a6c374]
   1: __FINI_00_remove_gp_range [0x3ff81a6c8f4]
   2: __FINI_00_remove_gp_range [0x3ff81a94e68]
   3: __FINI_00_remove_gp_range [0x3ff81a94538]
   4: main$rwinfnan_ [rwinfnan1.f: 27, 0x120001dd0]
   5: main [for_main.c: 203, 0x120001a94]
   6: __start [0x120001a08]

% f95 -fpe3 rwinfnan1.f && ./a.out
f90: Warning: rwinfnan1.f, line 3: This statement function has not been used.   [ISPINF]
      logical isnan, ispinf, isninf
---------------------^
f90: Warning: rwinfnan1.f, line 3: This statement function has not been used.   [ISNINF]
      logical isnan, ispinf, isninf
-----------------------------^
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /uufs/inscc.utah.edu/common/home/mthnhb/rwinfnan.tmp
   0: __FINI_00_remove_gp_range [0x3ff81a6c374]
   1: __FINI_00_remove_gp_range [0x3ff81a6c8f4]
   2: __FINI_00_remove_gp_range [0x3ff81a94e68]
   3: __FINI_00_remove_gp_range [0x3ff81a94538]
   4: main$rwinfnan_ [rwinfnan1.f: 27, 0x120001dd0]
   5: main [for_main.c: 203, 0x120001a94]
   6: __start [0x120001a08]
========================================================================
DEC Alpha 4100-5/266 (4 CPUs, 466 MHz, 2GB RAM);          OSF/1 4.0F

% g77 -mieee rwinfnan1.f && ./a.out
 NaN was written as:   NaNQ
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)

% f77 -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /a/suncore0/export/home/0074/sy/beebe/rwinfnan.tmp

% f90 -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /a/suncore0/export/home/0074/sy/beebe/rwinfnan.tmp

% f95 -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /a/suncore0/export/home/0074/sy/beebe/rwinfnan.tmp
========================================================================
DEC Alphastation 200 4/100 (1 CPU, 100 MHz Alpha 21064 EV4, 64MB RAM);    GNU/Linux 2.2.19-6.2.1

% f77 -mieee rwinfnan1.f && ./a.out
 NaN was written as:   NAN                                             
 Inf was written as:   INF                                             
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
You have new mail.

% fort -fpe3 rwinfnan1.f && ./a.out
 NaN was written as:  NaN                                              
 Inf was written as:  Infinity                                         
forrtl: severe (59): list-directed I/O syntax error, unit 1, file /a/suncore0/export/home/0074/sy/beebe/rwinfnan.tmp
========================================================================
HP 9000/712 (80 MHz PA-RISC 1.1 7100LC);  HP-UX 10.20

% f77 rwinfnan1.f && ./a.out
 NaN was written as:   ?.                                              
 Inf was written as:   ++.                                             
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
IOT trap (core dumped)
========================================================================
IBM RS6000 43P-132 (133 MHz);  AIX 4.2

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NaNQ
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)

% f77 -qfixed rwinfnan1.f && ./a.out
 NaN was written as:  NaNQ                                             
 Inf was written as:  INF                                              
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
 NaN was INCORRECTLY input as  0.0000000000E+00
1525-097 A READ statement using decimal base input found the invalid digit 'I' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'F' in the input file.  The program will recover by assuming a zero in its place.
 Inf was correctly input

% xlf90 -qfixed rwinfnan1.f && ./a.out
 NaN was written as:  NaNQ
 Inf was written as:  INF
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
 NaN was INCORRECTLY input as  0.0000000000E+00
1525-097 A READ statement using decimal base input found the invalid digit 'I' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'F' in the input file.  The program will recover by assuming a zero in its place.
 Inf was correctly input
========================================================================
IBM SP/2 AIX 4.3

% f77 rwinfnan1.f && ./a.out
** _main   === End of Compilation 1 ===
1501-510  Compilation successful for file rwinfnan1.f.
 NaN was written as:  NaNQ
 Inf was written as:  INF
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
 NaN was INCORRECTLY input as  0.0000000000E+00
1525-097 A READ statement using decimal base input found the invalid digit 'I' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'F' in the input file.  The program will recover by assuming a zero in its place.
 Inf was correctly input

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NaNQ
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)

% xlf90 -qfixed rwinfnan1.f && ./a.out
** _main   === End of Compilation 1 ===
1501-510  Compilation successful for file rwinfnan1.f.
 NaN was written as:  NaNQ
 Inf was written as:  INF
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
 NaN was INCORRECTLY input as  0.0000000000E+00
1525-097 A READ statement using decimal base input found the invalid digit 'I' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'F' in the input file.  The program will recover by assuming a zero in its place.
 Inf was correctly input

% xlf95 -qfixed rwinfnan1.f && ./a.out
** _main   === End of Compilation 1 ===
1501-510  Compilation successful for file rwinfnan1.f.
 NaN was written as:  NaNQ
 Inf was written as:  INF
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'a' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
 NaN was INCORRECTLY input as  0.0000000000E+00
1525-097 A READ statement using decimal base input found the invalid digit 'I' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'N' in the input file.  The program will recover by assuming a zero in its place.
1525-097 A READ statement using decimal base input found the invalid digit 'F' in the input file.  The program will recover by assuming a zero in its place.
 Inf was correctly input
========================================================================
Intel Pentium III (600 MHz);    GNU/Linux 2.2.17-14smp (Red Hat 6.2)

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NAN
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)

% lf95 rwinfnan1.f && ./a.out
A floating division exception was detected.
 Error occurs at or near line 13 of MAIN__

% pgf77 rwinfnan1.f && ./a.out
 NaN was written as:             -nan
 Inf was written as:              inf
 NaN was INCORRECTLY input as   0.0000000E+00
PGFIO-F-225/list-directed read/unit=1/lexical error-- unknown token type.
 File name = rwinfnan.tmp    formatted, sequential access   record = 2
 In source file rwinfnan1.f, at line number 34

% pghpf rwinfnan1.f && ./a.out
 NaN was written as:             -nan
 Inf was written as:              inf
 NaN was INCORRECTLY input as    0.0000000E+00
PGFIO-F-225/list-directed read/unit=1/lexical error-- unknown token type.
 File name = rwinfnan.tmp    formatted, sequential access   record = 2
 In source file rwinfnan1.f, at line number 34

% pgf90 rwinfnan1.f && ./a.out
 NaN was written as:             -nan
 Inf was written as:              inf
 NaN was INCORRECTLY input as    0.0000000E+00
PGFIO-F-225/list-directed read/unit=1/lexical error-- unknown token type.
 File name = rwinfnan.tmp    formatted, sequential access   record = 2
 In source file rwinfnan1.f, at line number 34
========================================================================
Intel Pentium II (2 CPUs, 450 MHz);       FreeBSD 4.2.0

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NaN                                             
 Inf was written as:   Inf                                             
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
========================================================================
SGI IRIX 6.5:

% f90 rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Infinity

lib-4190 : UNRECOVERABLE library error


Encountered during a list-directed READ from unit 1
Fortran unit 1 is connected to a sequential formatted text file:
  "rwinfnan.tmp"

% f77 rwinfnan1.f && ./a.out
 NaN was written as:  nan
 Inf was written as:  Inf
 NaN was INCORRECTLY input as   0.0000000E+00
 Inf was correctly input

% g77 rwinfnan1.f && ./a.out
ld32: WARNING 84 : /usr/lib32/libm.so is not used for resolving any symbol.
 NaN was written as:   NAN0X07FFFFE00
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
========================================================================
Sun Solaris 2.7:

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NaN
 Inf was written as:   Infinity
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)

% f77 rwinfnan1.f && ./a.out
 NaN was written as:   NaN
 Inf was written as:   Inf
 NaN was correctly input

% f95 -ftrap=%none rwinfnan1.f && ./a.out
 NaN was written as:  NaN
 Inf was written as:  Inf

 ******  FORTRAN RUN-TIME SYSTEM  ******
 Error 1084:  unexpected character in real value
 Location:  the READ statement at line 27 of "rwinfnan1.f"
 Unit:  1
 File:  rwinfnan.tmp
 Input:  NaN
         ^
% nagf90 -fixed -ieee=full rwinfnan1.f && ./a.out
 NaN was written as:              NaN                                  
 Inf was written as:         Infinity                                  
Invalid input for real editing
Program terminated by fatal I/O error
Abort (core dumped)

% nagf95 -fixed -ieee=full rwinfnan1.f && ./a.out
 NaN was written as:              NaN                                  
 Inf was written as:         Infinity                                  
Invalid input for real editing
Program terminated by fatal I/O error
Abort (core dumped)

========================================================================
Sun SPARC 10/51;               GNU/Linux 2.2.19-6.2.1 (Red Hat 6.2)

% g77 rwinfnan1.f && ./a.out
 NaN was written as:   NAN
 Inf was written as:   INF
invalid number: incomprehensible list input
apparent state: unit 1 named rwinfnan.tmp
last format: list io
lately reading sequential formatted external IO
Abort (core dumped)
