Internal compiler error getting RNG state

Internal compiler error getting RNG state

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

 

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Thanks, we'll check it out.

Steve - Intel Developer Support

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

 

Steve - Intel Developer Support

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

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today