Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29578 Discussions

Direct access file and double precision complex

natacha-marie-bereux
1,539 Views
Hi!
I want to write a 1000x1000 complex matrix "mat" in a direct access file.
When the matrix is in simple precision, my code works.
When the matrix is in double precision, my code fails, with a segmentation fault.
Attached is a very short test program which :

- initializes a complex matrix (the working precision "wp" can be made equal to "sp" (single precision) or "dp" (double precision))
- computes the length of the record rlength
- open a direct access file "mat.dat" with RECL=rlength
- writes mat in mat.dat

Something is wrong but I have no idea of what it is...
Thanks a lot if you can answer me !
Natacha
0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,539 Views
You're getting a stack overflow. The compiler is creating a temporary copy of the array on the stack because you wrote mat(:). Change that to just mat and it should work.
0 Kudos
natacha-marie-bereux
1,539 Views
Thanks a lot. I changed mat(:,:) to mat and it works.
Natacha
0 Kudos
Reply