Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Stack Overflow Bug when compiled with OpenMP?

Ulrich_M_
New Contributor I
232 Views

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
Devorah_H_Intel
Moderator
232 Views

The code builds and runs OK with 17.0.4 compiler.

0 Kudos
Reply