Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

segmentation fault on ifort

Status
Not open for further replies.

Pfor

Technical User
Aug 11, 2010
22
IT
Hallo all,
I just want to tell you about a problem I had with ifort
(probably most of you know about this problem but it took
me a lot of time to solve it).

The code worked fine with gfortran and with old versions of ifort.
I had no clue of what was happening.

In the code there is a subroutine,
and in the subroutine I declare some array e.g.:

If I write something like (being "ndim" a "big"
parameter taken from elsewere in the code):

real (kind = 8), dimension(ndim) :: vett

some recent version of ifort compile but return a segmentation fault when
the code is run,
while something like:

real (kind = 8), dimension:)), allocatable :: vett
allocate (vett(ndim))

works correctly!

(I found the solution here : )

That's all folks,
sorry if you already knew it,
cheers,
Paolo
 
Yes, this is a well known problem due to a limited stack size : automatic arrays are often allocated on the stack whereas allocatable arrays are always allocated on the heap... But this feature depends on the compiler and even on the compiler version.

I include for years in my .bashrc file the following instruction :

Code:
ulimit -s unlimited

This is also the advice proposed for Unix systems in the link you provided.

On Windows, as far as I remembered, the stack size could be provided when linking the executable program. But this solution was not very convenient because the needed stack size might depend on user parameters.

I did not know the option -heap-arrays which is indeed must more convenient. But I don't understand why Intel does not provide a reasonable default value for this parameter...

Thank you for the link

François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top