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

forrtl: severe (170): Program Exception - stack overflow

Ralph_Altenfeld
Beginner
1,151 Views
Hello,

I am presently using a very simple program (oversimplified case
of routines we are using in our code) which fails systematically with
this message error:
   000010    632525
forrtl: severe (170): Program Exception - stack overflow
Image PC Routine Line Source
Console2.exe 00000001400E8AA7 Unknown Unknown Unknown
Console2.exe 0000000140001433 MAIN__ 44 Console2.f90
Console2.exe 00000001400D5C4C Unknown Unknown Unknown
Console2.exe 0000000140066AB7 Unknown Unknown Unknown
Console2.exe 00000001400669BE Unknown Unknown Unknown
kernel32.dll 0000000077D5964C Unknown Unknown Unknown
The code is compiled using ifort 11.1.051 using the i64 and i32 versions.
The sources are:
!
PROGRAM Test
!
IMPLICIT NONE
!
INTEGER, PARAMETER :: Array_Size = 632525 ! 632525 ! 666
INTEGER, PARAMETER :: Buffer = 10, Skip = 100
INTEGER, ALLOCATABLE :: Array(:)
INTEGER :: Error, n, First, Last, Slide
!
!
ALLOCATE ( Array(Array_Size), STAT = Error )
!
IF ( Error .NE. 0 ) THEN
WRITE ( 6, "(//A//)" ) "Unable to allocate Array !"
STOP
END IF
!
DO n = 1, Array_Size
Array(n) = n
END DO
!
!
DO First = Buffer, ( Array_Size - Buffer ), Skip
WRITE ( UNIT = 6, FMT = "(2I10.6)" ) First, Array_Size
! DO Last = ( First + Buffer ), ( Array_Size - Buffer ), Skip
DO Last = ( Array_Size / 2 ), ( Array_Size - Buffer ), Skip
WRITE ( UNIT = 6, FMT = "(A10,3I10.6)" ) " ", First, &
& Last, Array_Size
DO Slide = Buffer, ( Array_Size - Last ), Skip
Array(Last+Slide:First+Slide:-1) = &
& Array(Last:First:-1)
END DO
END DO
END DO
!
END PROGRAM Test

This program is running without problem using gfortran
under linux and windows and using ifort under linux
Can one help me?

Thank you

Antoine
0 Kudos
1 Reply
Kevin_D_Intel
Employee
1,151 Views

The failure relates to array temporaries created for the assignment. You can either compile with /heap-arrays or increase the stack space by compiling using /F<value>. I found /F20000000 sufficient. This isn't needed on Linux because the default shell stack limit is sufficient for theprogram to run.
0 Kudos
Reply