Skip to content

Commit

Permalink
Fix two output conversion errors (#378)
Browse files Browse the repository at this point in the history
* icepack_itd: fix format string length causing "output conversion error"

With kcatbound = -1 (single category run) (or kcatbound = 2), hin_max(n)
is 100 (or 999), which is one character too long for the format
specification '(f6.3)' used to output it in icepack_init_itd_hist. This
leads to an "output conversion error" (Intel Fortran runtime error code
63, [1]), which is usually not fatal.

However, this error becomes fatal if FOR_DUMP_CORE_FILE [2] is defined in
the environment, which is necessary on some platforms to get core dumps
from a crashing program. Note that this interaction is *not* mentioned
in the Intel documentation.

Increase the format specifier by one digit to avoid this error. For
consistency, also increase it for 'hin_max(n-1)'.

[1] https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/error-handling/handling-run-time-errors/list-of-run-time-error-messages.html
[2] https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/compilation/supported-environment-variables.html#supported-environment-variables_GUID-D3C9AA20-CD90-4833-8B90-AB971E7B90B1

* icepack_fsd: fix format string length causing "output conversion error"

If floe_rad(n) or floe_rad(n-1) is greater or equal to 100, writing it
to c_fsd[12] with the format specifier '(f6.3)' causes an "output
conversion error" when compiling with the Intel compiler, as the format
spec is one digit short. This is not ideal for reasons detailed in the
previous commit.

Bump the format spec by one digit to avoid that error.
  • Loading branch information
phil-blain authored Dec 2, 2021
1 parent 152bd70 commit b7148ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions columnphysics/icepack_fsd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ subroutine icepack_init_fsd_bounds(nfsd, &
floe_rad(n) = floe_rad_h(n)
! Save character string to write to history file
write (c_nf, '(i2)') n
write (c_fsd1, '(f6.3)') floe_rad(n-1)
write (c_fsd2, '(f6.3)') floe_rad(n)
write (c_fsd1, '(f7.3)') floe_rad(n-1)
write (c_fsd2, '(f7.3)') floe_rad(n)
c_fsd_range(n)=c_fsd1//'m < fsd Cat '//c_nf//' < '//c_fsd2//'m'
enddo

Expand Down
4 changes: 2 additions & 2 deletions columnphysics/icepack_itd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1953,8 +1953,8 @@ subroutine icepack_init_itd_hist (ncat, hin_max, c_hi_range)
write (c_nc, '(i2)') n

! Write hin_max to character string
write (c_hinmax1, '(f6.3)') hin_max(n-1)
write (c_hinmax2, '(f6.3)') hin_max(n)
write (c_hinmax1, '(f7.3)') hin_max(n-1)
write (c_hinmax2, '(f7.3)') hin_max(n)

! Save character string to write to history file
c_hi_range(n)=c_hinmax1//'m < hi Cat '//c_nc//' < '//c_hinmax2//'m'
Expand Down

0 comments on commit b7148ee

Please sign in to comment.