Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
29 Views

Errors with derived type containing array with negative bounds

Trying to compile the following code with Intel Fortran Composer 17.0.0 results in a catastrophic internal compiler error.

module nrtype
    use iso_fortran_env
    implicit none

    integer, parameter :: itp = int8 ! Define quarter precision integer(1 bytes).
    integer, parameter :: ihp = int16! Define  half   precision integer(2 bytes).
    integer, parameter :: isp = int32! Define single  precision integer(4 bytes).
    integer, parameter :: idp = int64! Define double  precision integer(8 bytes)

    integer, parameter :: rsp = real32  ! Define single precision real ( 4 bytes). 7.22 decimal digits
    integer, parameter :: rdp = real64  ! Define double precision real ( 8 bytes). 14.95 decimal digits
    integer, parameter :: rqp = real128 ! Define quad   precision real (16 bytes). 34.02 decimal digits
end module nrtype

module modMesh
    use nrtype
    implicit none

    type DOFType(nEQs)
        integer(isp), len :: nEQs
        real(rdp) :: x
        real(rdp), dimension(nEQs) :: u, f, r
        real(rdp), dimension(nEQs,nEQs) :: fluxJac
    end type DOFType

    type cellType(nDOFs, nEQs)
        integer(isp), len :: nDOFs
        integer(isp), len :: nEQs
        integer(isp), dimension(2) :: idFace
        integer(isp), dimension(2) :: idNb
        type( DOFType(nEQs) ), dimension(nDOFs) :: DOF
    end type cellType

    type faceType(nDOFs, nEQs)
        integer(isp), len :: nDOFs
        integer(isp), len :: nEQs
        real(rdp) :: x
        integer(isp), dimension(2) :: idNb
        type( cellType(nDOFs, nEQs) ), pointer :: nbL, nbR
    end type faceType

    type meshType(nCells, nGhosts, nDOFs, nEQs)
        integer(isp), len :: nCells
        integer(isp), len :: nGhosts
        integer(isp), len :: nDOFs
        integer(isp), len :: nEQs

        integer(isp) :: nFaces

        type( faceType(nDOFs, nEQs) ), dimension(1-nGhosts:nCells+nGhosts) :: faceList
        type( cellType(nDOFs, nEQs) ), dimension(1-nGhosts:nCells+nGhosts) :: cellList
    end type meshType

    type( meshType(nCells=:, nGhosts=:, nDOFs=:, nEQs=:) ), target, allocatable :: mesh
end module modMesh

program test
    use nrtype
    use modMesh

    allocate ( meshType(5,5,1,1) :: mesh )

    mesh%cellList(-4)%DOF(1)%u(1) = 1.0

end program test

Replacing lines 50 and 51 for

        type( faceType(nDOFs, nEQs) ), dimension(-nGhosts:nCells+nGhosts) :: faceList
        type( cellType(nDOFs, nEQs) ), dimension(-nGhosts:nCells+nGhosts) :: cellList

prevents the compiler error but causes a segfault during execution.

0 Kudos
3 Replies
Highlighted
29 Views

What compiler options are you using? I haven't been able to make it fail yet.

 

0 Kudos
Highlighted
Beginner
29 Views

I was compiling without any flag but you are right it stopped crashing here also, i don't know what could have changed. But still i get segfaults for both versions of the code.
0 Kudos
Highlighted
29 Views

I can reproduce the segfault and have escalated it as issue DPD200414994. If you manage to see the internal compiler error again, please let us know the details.

0 Kudos