Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A very pedantic pull request #105

Merged
merged 4 commits into from
Apr 10, 2022
Merged

Commits on Apr 7, 2022

  1. Format string fixes; function index reorder

    This fixes several (extremely) minor issues in the source code which
    were detected as nonconformat by the `-pedantic` flag.
    
    None are serious, and none are likely to resolve any outstanding issues.
    The main benefit is that it allows us to apply the `-pedantic` flag into
    our testing, which can help to detect future issues.
    
    The issues which have been fixed are described below.
    
    * The `nX` edit descriptor must include the number of forward steps.
      The implicit single step (`1x == x`) is a compiler extension.
    
    * The no-advance line record write token `$` is a compiler extension
      which is not described in the standard.  Non-advancement is handled
      with the `advance='no'` argument.
    
    * Edit descriptors in format statements must be separated by commas,
      even though many compilers will ignore missing commas if there is no
      ambiguity.
    
    * When line continuation tokens are applied to strings, they must appear
      at both the end of the first line and the beginning of the subsequent
      line.  Most compilers do not require this second starting token.
    
    * In function descriptions, if a variable used in the declaration of
      another variable, such as an array index, then it must be declared
      before any other variables refers to it.
    
      For example, this is invalid:
      ```
         function foo(i0, x)
           real :: x(i0:)
           integer :: i0
      ```
      and `i0` must be declared before `x`.
    marshallward committed Apr 7, 2022
    Configuration menu
    Copy the full SHA
    936b11f View commit details
    Browse the repository at this point in the history
  2. Mixed layer restrat statement function refactor

    Statement functions are obsolescent in the current language standard,
    and can be redefined as an internal function within a subprogram.
    
    This patch replaces the statement function `psi` (streamfunction) in
    `mixedlayer_restrat_general` as an explicit internal function.
    marshallward committed Apr 7, 2022
    Configuration menu
    Copy the full SHA
    a535021 View commit details
    Browse the repository at this point in the history
  3. MOM_random: Set mask with bits rather than integer

    The MOM_random generator used bit masks which were set with integer
    values.  This is problematic for the sequence 0x8000 0000, because it
    must be set with a value of -2**31.
    
    In 4-byte integers, this is strictly not representable in Fortran, which
    requires symmetric signed domains for its variables.  Since the upper
    bound is 2**31 - 1, the lower bound must be -2**31 + 1, which is larger
    than -2**31.  Any value assigned to the 0x80000000 bit sequence is
    considered a noncompliant compiler extension.
    
    The current implementation seems to resolve this by using a kind=8 value
    (itself problematic, since 8-byte is not assured), but it still requires
    assigning this value to a 4-byte integer which cannot (strictly)
    represent the value.
    
    This patch averts the whole issue by explicitly setting the bits, and
    makes no reference to its integer value.  It leaves the compiler to
    decide its interpretation.  And since the variable is only used in bit
    operations, there is no ambiguity in behavior.
    
    Note that GCC 9 does not support BOZ conversion from z'80000000' to int,
    since it still expects BOZ literals to be within the bounds.  This is
    why we use ibset() in place of a literal.  Later GCC versions do not
    have this objection.
    marshallward committed Apr 7, 2022
    Configuration menu
    Copy the full SHA
    d2fb2d0 View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2022

  1. Configuration menu
    Copy the full SHA
    d3d0c8e View commit details
    Browse the repository at this point in the history