IV46460: INCORRECT ARRAY BOUND CHECKS AT -O5

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • The compiler seems to be incorrectly inserting a trap statement
    for array bound checks at -O5 for line 42 in the test case
    mentioned below
    ie
    cos_sin(:)%co = inivalue
    
    This causes the exe to trap at runtime.
    
    ===== COMPILE COMMAND:
     xl f2003 -g -O5 -qcheck -qfullpath -qextname test.f90
    
    ===== TESTCASE:
    $ cat test.f90
    program test
    
      implicit none
    
      type my_type
        real (kind=4)   :: co
        real (kind=4)   :: si
      end type my_type
    
      integer :: dim1 , dim2
      real (kind=4) :: initializevalue
    
      type(my_type), allocatable, dimension(:)    :: cos_sin_1d
      type(my_type), allocatable, dimension(:,:)  :: cos_sin_2d
    
      integer :: istatus
    
      dim1 = 34
      dim2 = 256
    
      initializevalue = 0.
    
      call test_1d(cos_sin_1d, dim1, initializevalue)
      call test_2d(cos_sin_2d, dim1, dim2, initializevalue)
    
    contains
    
      subroutine test_1d(cos_sin, lendim1, inivalue)
    
        type (my_type), intent (inout), allocatable, dimension(:)
    :: cos_sin
        integer               , intent (in)
             :: lendim1
        real (kind=4)         , intent (in)
             :: inivalue
    
        print*, 'test_1d: lendim1 =', lendim1
        print*, 'test_1d: (m1) allocated = ', allocated(cos_sin)
        if ( .not. allocated( cos_sin ) ) then
          if ( lendim1 > 0 ) then
    
            allocate( cos_sin(1:lendim1) )
            print*, 'test_1d: (m2) allocated = ', allocated(cos_sin)
    
            cos_sin(:)%co = inivalue
            cos_sin(:)%si = inivalue
    
          endif
        end if
    
      end subroutine test_1d
    
      subroutine test_2d(cos_sin, lendim1, lendim2, inivalue)
    
        type (my_type), intent (inout), allocatable, dimension(:,:)
     :: cos_sin
        integer               , intent (in)
             :: lendim1
        integer               , intent (in)
             :: lendim2
        real (kind=4)         , intent (in)
             :: inivalue
    
        print*, 'test_2d: lendim1 , lendim2 =', lendim1 , lendim2
        print*, "test_2d: (m1) allocated = ", allocated(cos_sin)
        if ( .not. allocated( cos_sin ) ) then
          if ( lendim1         > 0 .and. &
               lendim2         > 0 ) then
    
            allocate( cos_sin(1:lendim1, 1:lendim2) )
            print*, 'test_2d: (m2) allocated = ', allocated(cos_sin)
    
            cos_sin(:,:)%co = inivalue
            cos_sin(:,:)%si = inivalue
    
          endif
        end if
    
      end subroutine test_2d
    
    end program test
    $
    
    
    ===== ACTUAL OUTPUT:
    $ ./a.out
     test_1d: lendim1 = 34
     test_1d: (m1) allocated =  F
     test_1d: (m2) allocated =  T
     test_2d: lendim1 , lendim2 = 34 256
     test_2d: (m1) allocated =  F
     test_2d: (m2) allocated =  T
    Trace/BPT trap
    $
    
    ===== EXPECTED OUTPUT:
    $ ./a.out
     test_1d: lendim1 = 34
     test_1d: (m1) allocated =  F
     test_1d: (m2) allocated =  T
     test_2d: lendim1 , lendim2 = 34 256
     test_2d: (m1) allocated =  F
     test_2d: (m2) allocated =  T
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users who use the -qcheck option may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    Users will get core dumps because -qcheck incorrectly adds a
    trap with an incorrect offset.
    

Problem conclusion

  • The logic behind calculating the offset to include the trap was
    corrected to account for this scenario.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV46460

  • Reported component name

    XL FORTRAN FOR

  • Reported component ID

    5725C7400

  • Reported release

    E10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-07-31

  • Closed date

    2013-09-18

  • Last modified date

    2013-09-20

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

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

    LI77677

Fix information

  • Fixed component name

    XL FORTRAN FOR

  • Fixed component ID

    5725C7400

Applicable component levels

  • RE10 PSY U861038

       UP C



Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

XL Fortran for AIX
Compiler

Software version:

14.1

Reference #:

IV46460

Modified date:

2013-09-20

Translate my page

Machine Translation

Content navigation