Fixes an integer-kind mismatch in MOM_random, seed_from_time()#1113
Conversation
- gcc/8.3.0 issued `Error: Integer too big for its kind` reported in feedback on PR #1111. The intent was to assume kind=4 in these calculations but apparently our compilers were promoting `mod(dy + 32*(mo + 13*yr), 2147483648)` to kind=8. There were two mistakes in the expression: - the use of `2147483648` in the `mod` is not representable with kind=4; - the `mod` produces negative values and should have been a `modulo`. - This commit reduces the range of the results by one number on the positive side and removes all the negatives.
Codecov Report
@@ Coverage Diff @@
## dev-master-candidate-2020-05-15 #1113 +/- ##
==================================================================
Coverage ? 46.07%
==================================================================
Files ? 214
Lines ? 69379
Branches ? 0
==================================================================
Hits ? 31964
Misses ? 37415
Partials ? 0 Continue to review full report at Codecov.
|
|
I know this isn't the only place where this is being violated, but we really ought to stop assuming that I'd recommend using |
|
I can confirm it builds with gnu/8.3.0. |
|
@marshallward , it looks like If you want to support earlier Fortran versions, you can use Does the MOM6 development team have a position on minimal Fortran version required for model development? I don't see this at https://mom6.readthedocs.io/en/dev-gfdl/index.html or https://github.com/NOAA-GFDL/MOM6/wiki. |
|
@klindsay28 I recall last we discussed this, we found FMS had already moved onto 2008, and so we've opted to do the same. (We're already using I agree we need to clarify our target standard somewhere in the docs. |
Error: Integer too big for its kindreported infeedback on PR dev/master candidate 2020-05-15 #1111. The intent was to assume kind=4 in these
calculations but apparently our compilers were promoting
mod(dy + 32*(mo + 13*yr), 2147483648)to kind=8. There were twomistakes in the expression:
2147483648in themodis not representable with kind=4;modproduces negative values and should have been amodulo.positive side and removes all the negatives.
@gustavo-marques Could you test this patch for me? It passes everything at our end but so did the original PR.