This is the mail archive of the mailing list for the GNU Fortran project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran47, pgf90 work - ifort segfaults

On 02/10/2012 11:08 AM, Anton Shterenlikht wrote:
Intel: 12.0.2 20110112
The code below segfaults only when compiled with Intel compiler.

The code looks valid - and using ifort 11.1, 12.0.3 and 12.1.1, it does not crash for me; thus, it could be fixed in later 12.0.x versions or might have different reasons.

On issue which can lead to segfaults is a too small stack. And in particular the Intel compiler uses a lot of stack space by default. Stack memory is fast - faster than memory allocated on the heap. But the down side is: By default the available stack size is rather limited. Thus, one easily runs into stack issues. Having large arrays can require a lot of stack size - exceeding the available space leads to segfaults. If ifort places "space1" on the stack, you need 31.5 MB stack space. That's not very much but might be still too much. Could you check what "ulimit -s" (POSIX shell, bash) or "limit stack" (csh, tcsh) prints?

I know it's something to do with stream output
and array indexing. If I modify the write
line to either of these:
  write(unit=ou) space1
  write(unit=ou) space1(:,:,:)
  write(unit=ou) space1(0:201,:,:)
there is no segfault with intel.

However, these do segfault with intel:
  write(unit=ou) space1(1:200,:,:)
  write(unit=ou) space1(0:200,:,:)
  write(unit=ou) space1(10:200,:,:)
  write(unit=ou) space1(10:199,:,:)
Is there anything in stream output that
can lead to such behaviour?

Seems as if there is an issue with strides. It might be that ifort creates a temporay array for that (which would lead to more stack usage, cf. above). Of that it passes the array as is but has another bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]