- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear developers,
I observed a bug under Win7(64-bit) with Intel-12.1.2 Fortran-compiler :
In a write-stmt the Intel-compiler uses the stack, where it is not necessary, and then (certainly) aborts with a stack overflow, if the stack is too small.
Here are example stmts:
real, allocatable :: realarray(:,:)
ndim=500000
allocate( realarray(ndim,3) )
realarray = 0.0
open(100, form='unformatted')
write(100) realarray( :, 2 ) ! --> this works
write(100) realarray( :ndim, 2 ) ! --> this should be exacly the same, but results in a stack overflow
write(100) realarray( :ndim-100, 2 ) ! --> results also in a stack overflow
I remember darkly, that this kind of bug already appeared with the good old COMPAQ-Ftn-compiler.
Note, that this bug with the 2d-array does not occur for a 1d-array.
Greetings Michael R.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem persists with the 15.0.1.148 32- and 64-bit compilers on Windows 8.1. With the former, the traceback fails to give the line numbers, as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want a work around you could try setting /heap-arrays (Fortran>Optimization) .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not a bug, but perhaps a missed opportunity for optimization. In the second and third cases the compiler doesn't recognize that it can just use ndim or ndim-100 as the upper bound for an array slice and then use the general slice code it does for the first case - instead it creates a temporary that overflows the stack. I will suggest to the developers that they try to optimize this case as well, but it may be a while before they get to it. /heap-arrays is certainly a good workaround.

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