I am having problems with a bunch of lines returning a segmentation fault. Usually I tend to debug those problems pretty easily, but this time it appears I cannot solve the bug.
do i = 1,newSize call random_number(r1) jdo: do j = 1,maxK if(r1 <= cs(j)) then newSample(i)%k = j; exit jdo end if end do jdo end do
the array of the structure “newSample” has enough elements and the structure itself contains the field “k”.
The real array “cs” is large enough.
the code works as expected producing the expected results using other compilers (i’ve tested several versions of the gnu compiler and a couple of the intel one).
I do compile only using the “-g -O0” flags.
Any help will be appreciated, thanks.