Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Internal compiler error getting RNG state

jmcfarland101
Beginner
565 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
565 Views

Thanks, we'll check it out.

0 Kudos
Steven_L_Intel1
Employee
565 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
565 Views

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

0 Kudos
Reply