Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Segmentation fault

yshzhang
Beginner
504 Views
Dear all

In my fortran90 programme, I use a subroutine, and one parameter "N" as common in the whole programme.

subroutine TE1(SM,SdE)

common /rparam2/ N

real*8, allocatable :: SCPOS(:,:)
allocate (SCPOS(2,9*N))
...........
end subroutine

While the N may be changed in the main programme. Therefore the size of SCPOS matrix is coorespondingly changed. When I run the programme, after some iteration, it stoped by the classical "Segmentation fault" problem. When I checked the programme, I found a funny thing.
N is changed during the running, sometime it is keep as the old value according to the programme. I find that when N=343, the programme can run the subroutine and SCPOS is correctly generated about three times. While for the fouth time, it is not that luck. It can not finish the 9*N element in the matrix, and generate the error message of "Segmentation fault".

Thanks in advance.

Zhang
0 Kudos
1 Reply
Steven_L_Intel1
Employee
504 Views
This suggests that your program is overwriting memory, or perhaps there is a mismatch in arguments. Can you find the place where the variable's value is changed?
0 Kudos
Reply