- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?

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