IBM Support

LI82712: USING ERROR STOP CODE CAUSES TRAP

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • When using error stop code when executed the program will cause
    a TRAP as shown below.
    The program should execute and produce the ERROR STOP "message".
    
    ===== TESTCASE:
    $ cat spec.f90
    
    module finalizable_m
      !! This module supports the
    specification_expression_finalization main program
      !! (at the bottom of this file), which in turn supports the
    check_specification_expression
      !! unit-test function in ../test/compiler_test.f90.
      implicit none
    
      private
      public :: finalizable_t, component
    
      type finalizable_t
        private
        integer, pointer :: component_ => null()
      contains
        final :: finalize
      end Type
    
      interface finalizable_t
        module procedure construct
      end interface
    
    contains
    
      pure function construct(component) result(finalizable)
        integer, intent(in) :: component
        type(finalizable_t) finalizable
        allocate(finalizable%component_, source = component)
      end function
    
      pure function component(self) result(self_component)
        type(finalizable_t), intent(in) :: self
        integer self_component
        if (.not. associated(self%component_)) error stop
    "component: unassociated component"
        self_component = self%component_
      end function
    
      pure subroutine finalize(self)
        type(finalizable_t), intent(inout) :: self
        if (associated(self%component_)) deallocate(self%component_)
        error stop "finalize: intentional error termination to
    verify finalization"
      end subroutine
    
    end module
    
    program specification_expression_finalization
      !! Test the finalization of a function result in a
    specification expression
      use finalizable_m, only : finalizable_t, component
      implicit none
    
      call finalize_specification_expression_result
    
    contains
    
      subroutine finalize_specification_expression_result
        real tmp(component(finalizable_t(component=0))) !! Finalizes
    the finalizable_t function result
        real eliminate_unused_variable_warning
        tmp = eliminate_unused_variable_warning
      end subroutine
    
    end program
    $
    
    ===== ACTUAL OUTPUT:
    $ xlf2003_r spec.f90 -o spec -g
    $ ./spec
    Trace/BPT trap(coredump)
    $
    
    ===== EXPECTED OUTPUT:
    $ xlf2008_r spec_orig.f90
    finalizable_m === End of Compilation 1 ===
    specification_expression_finalization === End of Compilation 2
    ===
    1501-510 Compilation successful for file spec_orig.f90.
    $ ./a.out
    ERROR STOP 2
    $
    

Local fix

  • ===== WORKAROUND:
    The client can work around this issue by replacing the two ERROR
    STOP statements in the code to use integer stop code. For
    example, after replacing the first one inside the function
    component() with "ERROR STOP 1", and the second one inside the
    subroutine finalize() with "ERROR STOP 2", the client  observes
    the expected behavior:
    
    $ xlf2008_r spec_orig.f90
    
    finalizable_m === End of Compilation 1 ===
    specification_expression_finalization === End of Compilation 2
    ===
    1501-510 Compilation successful for file spec_orig.f90.
    $ ./a.out
    ERROR STOP 2
    
    The client can use the integer stop code in the meantime, it
    seems that using character just hit a bug in this particular
    case.
    

Problem summary

  • USERS AFFECTED:
    Users who use ERROR STOP with character string return code
    inside a PURE procedure.
    
    PROBLEM DESCRIPTION:
    When running the compiled testcase above with ERROR stop code it
    crashes with a TRAP.
    

Problem conclusion

  • The compiler was fixed by excluding ERROR STOP from PURE
    procedure checking.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI82712

  • Reported component name

    XL FORTRAN LINU

  • Reported component ID

    5725C7510

  • Reported release

    G11

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2022-10-21

  • Closed date

    2023-06-19

  • Last modified date

    2023-06-19

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

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

Fix information

  • Fixed component name

    XL FORTRAN LINU

  • Fixed component ID

    5725C7510

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":"G11","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
19 June 2023