The following code segfaults, and I'm unable to identify why:
PROGRAM segfault_transpose IMPLICIT NONE INTEGER, PARAMETER :: runs = 2 INTEGER, PARAMETER :: matrix_size = 1024 INTEGER :: j REAL, DIMENSION(matrix_size, matrix_size) :: alpha DO j = 1, runs alpha = TRANSPOSE(alpha) END DO END PROGRAM segfault_transpose
My compile line is:
ifort -O3 -xHost -real-size 64 segfault_transpose.f90
The issue occurs for runs >= 2, and matrix_size >= 1024, along with 64 bit reals. Also, it only happens if I feed the result of the transpose to the matrix itself.
I am using ifort version 18.0.3
The segfault message is as follows:
forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source a.out 000000000040473D Unknown Unknown Unknown libpthread-2.28.s 00007F77A49893C0 Unknown Unknown Unknown a.out 000000000040380C Unknown Unknown Unknown a.out 00000000004037DE Unknown Unknown Unknown libc-2.28.so 00007F77A47D7223 __libc_start_main Unknown Unknown a.out 00000000004036EE Unknown Unknown Unknown
a back-trace from gdb does not help; it says the issue is at line 1 !? :
#0 0x0000000000403803 in segfault_transpose () at segfault_transpose.f90:1 #1 0x00000000004037de in main () #2 0x00007ffff7c56223 in __libc_start_main () from /usr/lib/libc.so.6 #3 0x00000000004036ee in _start ()
valgrind's output has the following; but I don't know what it means:
==12271== Invalid write of size 8 ==12271== at 0x403803: MAIN__ (segfault_transpose.f90:1) ==12271== Address 0x1ffe7ff348 is on thread 1's stack
Can someone help me? I'm at a loss as to what exactly is happening.
p.s. gfortran seems to be fine