IBM Support

LI75926: SEGFAULT DUE TO SEGMENT VIOLATION

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case segfaults due to a pointer violation
    created by the compiler:
    
    ===== COMPILE COMMAND:
    $xlc -c zc.c
    $xlf90 -c -qsource,list zom.f
    $xlf90 -c -qsource,list zz.f
    $xlf90 zz.o zom.o zc.o
    
    ===== TESTCASE:
    $ cat zc.c
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    void zc(long long ii)
    {
      fprintf(stderr,"ii = %ld\n",ii);
    }
    $
    
    $ cat zom.f
    MODULE ZOM
    
    INTEGER :: JPNOTP
    
    parameter(jpnotp=10)
    
    !       JOT JO table, derived type
    TYPE jotsub_t
      CHARACTER(len=32) :: sname         ! name of sub-table
      REAL*8 , POINTER :: cost(:,:)      ! cost function value
      INTEGER, POINTER :: count(:,:)     ! data count
      REAL*8 , POINTER :: obimpact(:,:)  ! obs impact
    END TYPE jotsub_t
    
    TYPE jot_t
      CHARACTER(len=32)       :: name    ! name of table entry
      INTEGER                 :: size    ! size of sub-table
      TYPE(jotsub_t), POINTER :: jost(:) ! Jo sub-table
    END TYPE jot_t
    
    TYPE(jot_t) :: jot(JPNOTP)           ! Jo-table
    
    INTEGER :: NPRTBINS=1
    INTEGER :: JPXVAR=10
    
    end module zom
    
    $
    
    $ cat zz.f
    call zzz()
    end
    
    @PROCESS NOOPT
    SUBROUTINE zzz
    
      USE ZOM
      IMPLICIT NONE
    
    
      INTEGER :: INOCTP,JCTP,IOBTYP
    
      INOCTP=10
      IOBTYP=10
    
    
            ALLOCATE(JOT(IOBTYP)%jost(INOCTP))
    
            do jctp=1,10
    
              ALLOCATE(JOT(IOBTYP)%jost(JCTP)%cost
    (JPXVAR,NPRTBINS))
    
    ALLOCATE(JOT(IOBTYP)%jost(JCTP)%count(JPXVAR,NPRTBINS))
    
    ALLOCATE(JOT(IOBTYP)%jost(JCTP)%obimpact(JPXVAR,NPRTBINS))
    
              write(0,*) "IOBTYP,JCTP=",IOBTYP,JCTP
              call zc(JOT(IOBTYP)%jost(JCTP)%cost(1,1))
              JOT(IOBTYP)%jost(JCTP)%cost(:,:)= 0.0
              JOT(IOBTYP)%jost(JCTP)%count(:,:)= 0.0
              JOT(IOBTYP)%jost(JCTP)%obimpact(:,:) = 0.0
    
            enddo
    
    END
    $
    
    
    
    ===== ACTUAL OUTPUT:
    $ ./a.out
     IOBTYP,JCTP= 10 1
    ii = 51245076
    Segmentation fault
    $
    
    ===== EXPECTED OUTPUT:
    $ ./a.out
     IOBTYP,JCTP= 10 1
    ii = 536876824
     IOBTYP,JCTP= 10 2
    ii = 537003080
     IOBTYP,JCTP= 10 3
    ii = 537003320
     IOBTYP,JCTP= 10 4
    ii = 537003560
     IOBTYP,JCTP= 10 5
    ii = 537003800
     IOBTYP,JCTP= 10 6
    ii = 537004040
     IOBTYP,JCTP= 10 7
    ii = 537004280
     IOBTYP,JCTP= 10 8
    ii = 537004520
     IOBTYP,JCTP= 10 9
    ii = 537004760
     IOBTYP,JCTP= 10 10
    ii = 537005000
    $
    

Local fix

  • n/a
    

Problem summary

  • USERS AFFECTED:
    Users who use modules to declare variables of types containing
    pointer alike components will be affected.
    
    PROBLEM DESCRIPTION:
    The execution of the program fails in a particular situation.
    1. The program contains a reference to a variable that is of
    derived type containing a allocatable/pointer
    component and declared in a module, and
    
    2. There is a variable declared in the same module and
    appearing before the affected variable.
    

Problem conclusion

  • When computing base address of an internal component, the
    compiler needed to take module variables into consideration.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI75926

  • 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

    2011-01-27

  • Closed date

    2011-01-27

  • Last modified date

    2011-01-27

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

    IZ72918

  • 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