ACCESS-NRI/cice5

gcc: Error: Period required in format specifier E at (1)

Closed this issue ยท 9 comments

$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
sat_vapor_pres_mod.f90:726:22:

  726 |    write(6,'(a,e,a,i4)') 'ice: Bad temperature=',temp,' pe=',my_task
      |                      1
Error: Period required in format specifier E at (1)
sat_vapor_pres_mod.f90:741:24:

  741 |      write(6,'(a,e,a,i4,a,i4)') 'ice: Bad temperature=',temp(i),'  at i=',i,' pe=',my_task
      |                        1
Error: Period required in format specifier E at (1)
sat_vapor_pres_mod.f90:758:24:

  758 |      write(6,'(a,e,a,i4,a,i4,a,i4)') 'ice: Bad temperature=',temp(i,j),'  at i=',i,' j=',j,' pe=',my_task
      |                        1
Error: Period required in format specifier E at (1)
sat_vapor_pres_mod.f90:777:24:

  777 |      write(6,'(a,e,a,i4,a,i4,a,i4,a,i4)') 'ice: Bad temperature=',temp(i,j,k),'  at i=',i,' j=',j,' k=',k,' pe=',my_task
      |                        1
Error: Period required in format specifier E at (1)
$ ag 'a,e,a' drivers/auscom/sat_vapor_pres_mod.F90
714:!!   write(stdout(),'(a,e,a,i4)') 'Bad temperature=',temp,' pe=',mpp_pe()
715:   write(6,'(a,e,a,i4)') 'ice: Bad temperature=',temp,' pe=',my_task
729:!!     write(stdout(),'(a,e,a,i4,a,i4)') 'Bad temperature=',temp(i),'  at i=',i,' pe=',mpp_pe()
730:     write(6,'(a,e,a,i4,a,i4)') 'ice: Bad temperature=',temp(i),'  at i=',i,' pe=',my_task
746:!!     write(stdout(),'(a,e,a,i4,a,i4,a,i4)') 'Bad temperature=',temp(i,j),'  at i=',i,' j=',j,' pe=',mpp_pe()
747:     write(6,'(a,e,a,i4,a,i4,a,i4)') 'ice: Bad temperature=',temp(i,j),'  at i=',i,' j=',j,' pe=',my_task
765:!!     write(stdout(),'(a,e,a,i4,a,i4,a,i4,a,i4)') 'Bad temperature=',temp(i,j,k),'  at i=',i,' j=',j,' k=',k,' pe=',mpp_pe()
766:     write(6,'(a,e,a,i4,a,i4,a,i4,a,i4)') 'ice: Bad temperature=',temp(i,j,k),'  at i=',i,' j=',j,' k=',k,' pe=',my_task

On Gadi using ifort:

program print_pi
  implicit none
  real :: pi

  pi = 3.141592653589793238
  print "(a, e)", "e: ", pi
  print "(a, g0)", "g0: ", pi
end program print_pi
$ for c in $(module avail -t intel-compiler/ | grep ^intel); do module load $c; ifort -v ; ifort print_pi.f90 -o print_pi; ./print_pi ; rm -f ./print_pi ; module unload $c; echo ; done

ifort version 19.0.3.199
e:   0.3141593E+01
g0: 3.141593

ifort version 19.0.4.243
e:   0.3141593E+01
g0: 3.141593

ifort version 19.0.5.281
e:   0.3141593E+01
g0: 3.141593

ifort version 19.1.0.166
e:   0.3141593E+01
g0: 3.141593

ifort version 19.1.1.217
e:   0.3141593E+01
g0: 3.141593

ifort version 19.1.2.254
e:   0.3141593E+01
g0: 3.141593

ifort version 19.1.3.304
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.1
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.2.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.3.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.4.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.5.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.6.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.7.0
e:   0.3141593E+01
g0: 3.141593

ifort version 2021.8.0
e:   0.3141593E+01
g0: 3.141593

On Gadi using gcc:

program print_pi
  implicit none
  real :: pi

  pi = 3.141592653589793238
  print "(a, e)", "e: ", pi
  print "(a, g0)", "g0: ", pi
end program print_pi
$ for c in $(module avail -t gcc/ | grep ^gcc); do module load $c; gcc --version ; gfortran print_pi.f90 -o print_pi; ./print_pi ; rm -f ./print_pi ; module unload $c; echo ; done

gcc (GCC) 10.3.0
...

print_pi.f90:6:20:

    6 |   print "(a, e)", "e: ", pi
      |                    1
Error: Period required in format specifier E at (1)
bash: ./print_pi: No such file or directory

gcc (GCC) 11.1.0
...

print_pi.f90:6:20:

    6 |   print "(a, e)", "e: ", pi
      |                    1
Error: Period required in format specifier E at (1)
bash: ./print_pi: No such file or directory

gcc (GCC) 12.2.0
...

print_pi.f90:6:20:

    6 |   print "(a, e)", "e: ", pi
      |                    1
Error: Period required in format specifier E at (1)
bash: ./print_pi: No such file or directory

gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-15)
...

print_pi.f90:6:13:

   print "(a, e)", "e: ", pi
             1
Error: Positive width required in format specifier E at (1)
bash: ./print_pi: No such file or directory

On Gadi using gcc (s/e/e0.0/):

program print_pi
  implicit none
  real :: pi

  pi = 3.141592653589793238
  print "(a, e0.0)", "e0.0: ", pi
  print "(a, g0)", "g0: ", pi
end program print_pi
$ for c in $(module avail -t gcc/ | grep ^gcc); do module load $c; gcc --version ; gfortran print_pi.f90 -o print_pi; ./print_pi ; rm -f ./print_pi ; module unload $c; echo ; done
gcc (GCC) 10.3.0
...

e0.0: 0.314159274E+1
g0: 3.14159274

gcc (GCC) 11.1.0
...

e0.0: 0.314159274E+1
g0: 3.14159274

gcc (GCC) 12.2.0
...

e0.0: 0.314159274E+1
g0: 3.14159274

gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-15)
...

print_pi.f90:6:14:

   print "(a, e0.0)", "e0.0: ", pi
              1
Error: Positive width required in format specifier E at (1)
bash: ./print_pi: No such file or directory

On Gadi using ifort (s/e/e0.0/):

ifort version 19.0.5.281
print_pi.f90(6): error #6185: This constant is out-of-range in a format list.   [0]
  print "(a, e0.0)", "e0.0: ", pi
--------------^
print_pi.f90(6): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
  print "(a, e0.0)", "e0.0: ", pi
--------------^
print_pi.f90(6): remark #8577: The scale factor (k) and number of fractional digits (d) do not have the allowed combination of either -d < k <= 0 or 0 < k < d+2. Expect asterisks as output.
  print "(a, e0.0)", "e0.0: ", pi
----------------^
compilation aborted for print_pi.f90 (code 1)
bash: ./print_pi: No such file or directory

On Gadi using ifort (W>=D+7):

program print_pi
  implicit none
  real :: pi

  pi = 3.141592653589793238
  print "(a, e)", "e:    ", pi
  print "(a, e14.7)", "e14.7: ", pi
  print "(a, g0)", "g0:     ", pi
end program print_pi
$ for c in $(module avail -t intel-compiler/ | grep ^intel); do module load $c; ifort -v ; ifort print_pi.f90 -o print_pi; ./print_pi ; rm -f ./print_pi ; module unload $c; echo ; done
ifort version 19.0.3.199
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.0.4.243
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.0.5.281
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.1.0.166
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.1.1.217
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.1.2.254
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 19.1.3.304
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.1
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.2.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.3.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.4.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.5.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.6.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.7.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

ifort version 2021.8.0
e:      0.3141593E+01
e14.7:  0.3141593E+01
g0:     3.141593

On Gadi using gcc (W>=D+7):

program print_pi
  implicit none
  real :: pi

  pi = 3.141592653589793238
  print "(a, e0.0)", "e0.0:   ", pi
  print "(a, e14.7)", "e14.7: ", pi
  print "(a, g0)", "g0:     ", pi
end program print_pi
$ for c in $(module avail -t gcc/ | grep ^gcc); do module load $c; gcc --version ; gfortran print_pi.f90 -o print_pi; ./print_pi ; rm -f ./print_pi ; module unload $c; echo ; done
gcc (GCC) 10.3.0
...

e0.0:   0.314159274E+1
e14.7:  0.3141593E+01
g0:     3.14159274

gcc (GCC) 11.1.0
...

e0.0:   0.314159274E+1
e14.7:  0.3141593E+01
g0:     3.14159274

gcc (GCC) 12.2.0
...

e0.0:   0.314159274E+1
e14.7:  0.3141593E+01
g0:     3.14159274

gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-15)
...

print_pi.f90:6:14:

   print "(a, e0.0)", "e0.0:   ", pi
              1
Error: Positive width required in format specifier E at (1)
bash: ./print_pi: No such file or directory
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-15)
...

e14.7:  0.3141593E+01
g0:     3.14159274

Hi @aidanheerdegen & @micaeljtoliveira ,

What do you think of s/e/e14.7/ ?

e.g. 5b05d86

What do you think of s/e/e14.7/ ?

Seems like the common compatible option so ๐Ÿ‘

Looks like a good solution here.

PR: #7