IBM Support

LI75385: ISSUE WITH EXPLICIT SHAPE ARRAYS

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • An assumed shape array is passed to a subroutine and declared as
    an explicit array inside the subroutine.  This leads to
    incorrect results in the content of the passed array.
    
    The test case below displays this behaviour.   Since
    the subroutine, s2, has no interface definition, the array
    argument should be passed as a FORTRAN77 array and explicit/
    assumed array shape should not matter for the results.
    
    
       ======  TESTCASE  ======
    
      type dt
         integer :: idx (4)
      end type
      type(dt), allocatable :: c(:)
    
      allocate (c(3))
    
      c(:)% idx(4) = (/1,2,3/)
      call s1 (c(:)% idx(4))
    
    contains
    
      subroutine s1 (DX)
        integer               :: DX(:)
        if ( any(dx /= (/1,2,3/)) ) stop 10
        call s2 ( DX)
      end subroutine
    
      SUBROUTINE s2 (DATA)
        INTEGER  ,INTENT(IN)  :: DATA(3)    ! Incorrect Output
    !    INTEGER  ,INTENT(IN)  :: DATA(:)    ! Correct Output
    
        print *, "DATA =", data
        if ( any(data /= (/1,2,3/)) ) stop 11
    
      END SUBROUTINE
    
    end
    

Local fix

  • To workaround the issue, the declaration of the array in the
    subroutine needs to be changed from assumed shape to explicit
    shape.
    

Problem summary

  • USERS AFFECTED:
    Users passing discontiguous dummy-arg arrays by descriptor to
    routines that operate on contiguous arrays by default.
    
    PROBLEM DESCRIPTION:
    The compiler may interpret/output the passed array incorrectly.
    

Problem conclusion

  • The compiler was improved to better detect discontiguity.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI75385

  • Reported component name

    XL FORTRAN RHEL

  • Reported component ID

    5724U8410

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-04-27

  • Closed date

    2010-04-27

  • Last modified date

    2010-04-27

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

    IZ65814

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

Fix information

  • Fixed component name

    XL FORTRAN RHEL

  • Fixed component ID

    5724U8410

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSB259","label":"XL Fortran Advanced Edition for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"C.1","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
24 February 2022