Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
12 Views

Stack Overflow Bug when compiled with OpenMP?

The following code compiles but crashes with a stack overflow on entry in the parallel region when compiled with OpenMP. I played with stack settings, but to no avail. Removing the block construct leads to expected results, as do other trivial changes to the program.

module compute
    implicit none
    integer             :: nth, ny 
    integer, parameter  :: nsim=20
    real, allocatable   :: Ys(:,:)
    
    contains
    
    subroutine prep
        integer :: l
        real    :: Y(ny),th(nth)

!$omp parallel do private(Y) 
        do l=1,nsim
            y=0
        enddo
        print *,"done"

        block
            do l=1,10
                Y=5
                th=0
            enddo
        end block
     
    end subroutine

end module    


program mfort
    use compute
    
    implicit none
    
    nth=5; ny=8; 
    allocate(Ys(ny,nsim))
    print *,"hello"
    call prep
    
end program

 

0 Kudos
1 Reply
Highlighted
Moderator
12 Views

The code builds and runs OK with 17.0.4 compiler.

0 Kudos