- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
I have the simple test program below which allocates two matrixes and copies them. I compile and run it with ifort and I get a segmentation fault, no standard output is written, even compiling with the -g option. With g95 compiler just works fine. Is there anything I am doing wrong?
The machine details are:
Linux dgnl1 2.6.5-7.308-bigsmp #1 SMP Mon Dec 10 11:36:40 UTC 2007 i686 i686 i386 GNU/Linux
I am using ifc 10.1.018.
Any help would be highly appreciated.
Javier
program copyMatrix
DOUBLE PRECISION, POINTER, DIMENSION(:,:) :: test
DOUBLE PRECISION, POINTER, DIMENSION(:,:) :: test2
INTEGER :: allocStat
ALLOCATE( test(1300,1200), STAT=allocStat )
IF (allocStat /= 0 ) THEN
write(*,*)'Error allocating matrix 1'
END IF
ALLOCATE( test2(1300,1200),STAT=allocStat )
IF (allocStat /= 0 ) THEN
write(*,*)'Error allocating matrix 2'
END IF
write(*,*)'Filling matrix 1'
test2 = 0
write(*,*)'Filling matrix 2'
test1 = 0
write(*,*)'Copying matrix'
test(1 : 1300, 1 :1200)= test2
print *,"Done!"
end program copyMatrix
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have not done anything wrong. The Intel Fortran compiler is using array temporaries on the stack to accomplish the copy in question. I do not believe temps should be required in this case and will forward this to our compiler developers to investigate.
As a work-around, the program runs successfully with the 10.1 compiler only if one increases the shell stack limit via:
For Bash/sh/ksh use: ulimit -s unlimited
For Csh use: limit stacksize unlimited
The program also runs successfully only with our 11.0 Beta compiler using the same limit commands above or when the program is compiled with: -heap-arrays
It appears the 10.1 compilerhas a further issue of not honoring placement of the array temps on the heap when using heap-arrays
(Internal ref. CQ-109896)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue noted with 10.1 and heap-arrays not affecting placement of the array temporaries was a compiler defect that is fixed in the latest 11.0 Release.
Development also corrected my understanding about the use of array temporaries in the example provided. They note test and test2 are POINTER arrays, not actually allocatable arrays. If the POINTER declarations are changed to ALLOCATABLEthenno array temporaries are required and the example runs without the requirement for -heap-arrays. When declared as POINTER, there is potential for overlap (although not in this specific case); therefore, the temporaries are used. As Steve discusses here, if the interest is in "dynamic arrays", the recommendation is to use ALLOCATABLE.
Development is currently investigating a similar case discussed here to determine if/how to avoid the use of array temporaries. You may want to stay tuned to that thread.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page