IBM Support

LI76073: INCORRECT ASSIGN WITH ALLOCATION WITH XLF2003

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following code shows that 'assign' is being called
    incorrectly for allocations with xlf2003:
    
    ==Compile Command:
    xlf2003 test.F90
    
    ==Test case:
    $cat test.F90
    module hermetic_module
      implicit none
      private
      public :: hermetic
      type,abstract::hermetic
      end type
    end module
    
    module ref_counter_module
      use hermetic_module, only: hermetic
      private
      public :: ref_counter
      type,extends(hermetic):: ref_counter
         private
         class(hermetic),pointer :: obj => null()
      contains
         procedure :: assign
         generic :: assignment(=) => assign
      end type
      interface ref_counter
          module procedure constructor
      end interface
    contains
    subroutine assign (lhs, rhs)
      class (ref_counter), intent(inout) :: lhs
      class (ref_counter), intent(in) :: rhs
      print *,'assign'
      lhs%obj => rhs%obj
      print *,'rhs:',associated(lhs%obj),associated(rhs%obj)
    end subroutine
    function constructor (object)
      class(hermetic), intent(in) :: object
      type(ref_counter), allocatable :: constructor
      print *,'constructor start'
      allocate (constructor)
      allocate (constructor%obj, source=object)
      print *,'constructor:',associated(constructor%obj)
    end function
    end module
    
    module universal_module
      use hermetic_module ,only : hermetic
      use ref_counter_module, only : ref_counter
      implicit none
      type ,abstract ,extends(hermetic) :: universal
        private
        type(ref_counter) :: counter
        contains
        procedure,non_overridable:: register_self
      end type
     contains
     subroutine register_self(this)
      class(universal) ,intent(inout) :: this
      this%counter=ref_counter(this)
     end subroutine
    end module
    
    module map_module
     use universal_module, only: universal
     implicit none
     private
     public :: map
     type, extends(universal) :: map
      integer::id
     end type
     interface map
      module procedure new_map
     end interface
     contains
     type(map) function new_map()
      new_map%id=1
      call new_map%register_self()
     end function
    end module
    
    program main
     use map_module, only: map
     type(map):: m
     m=map()
    end
    $
    
    ==Actual Output:
    $./a.out
     constructor start
     assign
     rhs: F F
     constructor: T
     assign
     rhs: T T
     assign
     rhs: T T
    $
    
    ==Expected Output:
    $./a.out
     constructor start
     constructor: T
     assign
     rhs: T T
     assign
     rhs: T T
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users of XL Fortran who have programs containing defined
    assignment bindings may be affected
    by this issue.
    
    PROBLEM DESCRIPTION:
    When a type has a defined assignment binding, and the program
    tries to initialize an allocated
    object using the SOURCE= specifier, XL Fortran calls the
    defined assignment routine specified in
    the binding. This occurred only when the type did not contain
    runtime length type parameters.
    

Problem conclusion

  • The above issue has been fixed so that the compiler does not
    call the defined assignment routine specified in
    the binding.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76073

  • 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:

    IZ91456

  • 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