IBM Support

LI76065: NON STANDARD PROG COMPILES W/O (L) MSG

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The first of the two programs below do not conform to the
    Fortran Standard.
    
    The issue is that the user should have an explicit interface
    for the 'binary_search' function because it has an assumed-
    shape array argument. The compiler passes extra hidden
    arguments and/or descriptors for assumed-shape arrays, and
    thus it needs to do that on the caller side.
    
    Inaddition, the standard says that the interface of a function
    is explicit within the function if the function has the
    result() clause, otherwise, it is not explicit. So a result
    clause should be reported as missing by the compiler.
    
    However there is no "L" warning messages when compiling with
    -qlanglvl set with conformance with standard Fortran 90, 95 or
    2003.
    
    ========== Test case 1
    (This should cause the compiler to produce a message during
    compilation)
    
     recursive function binary_search(field,what)
      integer, dimension(:),intent(in) :: field
      integer, intent (in) :: what
      integer :: binary_search
      integer :: n,mid
      n=size(field)
      if (n==0) then
       binary_search = 0
       return
      end if
      mid = n/2 + 1
      if (field(mid)>what) then
       binary_search = binary_search(field(1:mid-1),what)
      else if (field(mid)<what) then
       binary_search = binary_search(field(mid+1:n),what)
       if (binary_search /= 0 ) binary_search = binary_search + mid
      else ! field(mid)==what)
       binary_search = mid
      end if
     end function binary_search
    
    
    ========== Test case 2
    (This is the correct version of the program)
    
     recursive function binary_search(field,what) result(found)
      integer, dimension(:),intent(in) :: field
      integer, intent (in) :: what
      integer :: found
      integer :: n,mid
      n=size(field)
      if (n==0) then
       found = 0
       return
      end if
      mid = n/2 + 1
      if (field(mid)>what) then
       found = binary_search(field(1:mid-1),what)
      else if (field(mid)<what) then
       found = binary_search(field(mid+1:n),what)
       if (found /= 0 ) found = found + mid
      else ! field(mid)==what)
       found = mid
      end if
     end function binary_search
    

Local fix

  • N/A
    

Problem summary

  • PROBLEM DESCRIPTION:
    A recursive function containing a self reference must have a
    result value specified in the declaration of the function, by
    the Fortran standard. We do not flag this as with a language
    level message and allow non-standard Fortran programs.
    
    USERS AFFECTED:
    Anyone making use of the -qlanglvl option.
    

Problem conclusion

  • An appropriate language level message will now be generated,
    flagging the non-conforming semantics. A recursive function
    without a result value containing a self reference will cause
    the message to be generated.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76065

  • Reported component name

    XL FORTRAN LINU

  • Reported component ID

    5724X1600

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2011-04-27

  • Closed date

    2011-04-27

  • Last modified date

    2011-04-27

  • APAR is sysrouted FROM one or more of the following:

    IZ86161

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL FORTRAN LINU

  • Fixed component ID

    5724X1600

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSAT4T","label":"XL Fortran for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"D10","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
17 October 2021