Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Internal compiler error getting RNG state

jmcfarland101
Beginner
330 Views

The following code generates an internal compiler error with 14.0.3.202:

MODULE rng_state
  TYPE StateType
    INTEGER, ALLOCATABLE :: s(:)
  END TYPE StateType
  TYPE (StateType) :: state
CONTAINS
  SUBROUTINE get()
    INTEGER :: i
    CALL RANDOM_SEED(size=i)
    IF (.NOT. ALLOCATED(state%s)) ALLOCATE( state%s(i) )
    CALL random_seed(get=state%s)
  END SUBROUTINE get
END MODULE rng_state

 

0 Kudos
3 Replies
Steven_L_Intel1
Employee
330 Views

Thanks, we'll check it out.

0 Kudos
Steven_L_Intel1
Employee
330 Views

I can reproduce this and have escalated it to development as issue DPD200358912.

A workaround is to do this:

  SUBROUTINE get()
    INTEGER :: i
    integer, allocatable :: state_temp(:)
    CALL RANDOM_SEED(size=i)
    ALLOCATE(state_temp(i))
    CALL random_seed(get=state_temp)
    CALL move_alloc(FROM=state_temp, TO=state%s)
  END SUBROUTINE get

 

0 Kudos
Steven_L_Intel1
Employee
330 Views

This bug has been fixed for an update later this year (not in the initial 15.0 release.)

0 Kudos
Reply