0
votes

I am trying to compile and run code that was supposedly successfully compiled and run using Intel compiler version 11. However I have version 14, and I can not manage to run it without getting segmentation fault.

subroutine iireg2(iidata,iicoeffs)
use myparams
implicit none
real(8):: iidata(:,:)
real(8)::z(size(iidata,1),size(iidata,2)-1)
real(8)::iicoeffs(size(iidata,2)-1)
integer:: ncoeffsa,flag1,i

ncoeffsa=size(iidata,2)-1

print*, 'this is ncoeffsa', ncoeffsa
print*, 'this is aaiadata1', iidata(1,:)
print*, 'this is size', size(iidata,2)-1
print*, 'this is aaiadata2', iidata(1,2:(ncoeffsa+1))
print*, 'this is aaiadata2', iidata(143345,2:(ncoeffsa+1))

print*, 'dimz 1', size(z,1)
print*, 'dimz 2', size(z,2)
print*, 'dimiidata 1', size(iidata,1)
print*, 'dimiidata 2', size(iidata,2)

! segmentation fault occurs if I uncomment below
! and pass N x 12 array. If I pass N x 1 array
! I do not get segmentation fault.
!z(:,:)=iidata(:,2:(ncoeffsa+1))
end subroutine iireg

I call that subroutine with something like the following

print*, 'stempp', stempp
print*, 'siidata outside', siidata(1,:)
print*, 'siidata 1 dim', size(siidata,2)-1
print*, 'siidata 2 dim', size(siidata,1)
siidata = siidata*0
stempp = stempp*0

call iireg2(siidata,stempp)

Before I use this subroutine, I print and make sure that all dimensions are correct. I also replace all entries of the matrix with zeros just for now. All dimensions and sizes match up. Variables types are also correct. The function works successfully if I pass something that has dimension N x 1 (N is around 10,000). However when I pass something that happens to be N x 12, I get segmentation fault.

1
Is an explicit interface for the subroutine available in the calling scope (if not, it needs one). Are you likely to be running into stack size limits? Are you compiling with the -heaparrays option? - IanH
Do you use modules? Or interface blocks? Where is that subroutine relative to the calling code? Can you prepare a full small example? stackoverflow.com/help/mcve - Vladimir F

1 Answers

2
votes

Have you tried the -heap-arrays compiler option? This article list the possible causes for segmentation faults: https://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors