Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ulrich_M_
New Contributor I
195 Views

openMP combined with internal subroutine bug

The following program does not produce the correct results / crashes under 19.1.2.254. The subroutine test does not seem to get passed the right info about the variable s. The problem disappears without the parallel loop, or without the internal subroutine.

module runmod
	implicit none
	integer						:: n

	contains
	
	subroutine 	test(s) 
		real	:: s(:,:)
		print *,sum(s)
	end subroutine

	subroutine chk
		real		:: s(2,n)
		integer		:: l
		s=reshape([(l,l=1,2*n)],[2,n])
!$omp parallel do 
			do l=1,20
				call test(s)
			enddo					
			
	contains

		subroutine chksub
			integer	:: i
			do i=1,20
				call test(s)
			enddo
		end subroutine
	end subroutine
end module
	
program pchk
	use runmod
	implicit none
	n=5
	call chk
end program

 

0 Kudos
2 Replies
Johannes_Rieke
New Contributor III
173 Views

Hi Ulrich, I can confirm this runtime error for PSXE2020u2 on Windows OS.

ifort int_sub_omp.f90 /Qopenmp /Od /traceback
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.2.254 Build 20200623
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.16.27043.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:int_sub_omp.exe
-subsystem:console
-incremental:no
-defaultlib:libiomp5md.lib
-nodefaultlib:vcomp.lib
-nodefaultlib:vcompd.lib
int_sub_omp.obj

 

int_sub_omp.exe
forrtl: severe (157): Program Exception - access violation
Image              PC                Routine            Line        Source
int_sub_omp.exe    00007FF7BF1F1150  RUNMOD_mp_TEST              9  int_sub_omp.f90
int_sub_omp.exe    00007FF7BF1F17ED  RUNMOD_mp_CHK              19  int_sub_omp.f90
libiomp5md.dll     00007FF8CA5B44A3  Unknown               Unknown  Unknown
libiomp5md.dll     00007FF8CA50D077  Unknown               Unknown  Unknown
libiomp5md.dll     00007FF8CA50E683  Unknown               Unknown  Unknown
libiomp5md.dll     00007FF8CA4CB7FD  Unknown               Unknown  Unknown
int_sub_omp.exe    00007FF7BF1F1679  RUNMOD_mp_CHK              17  int_sub_omp.f90
int_sub_omp.exe    00007FF7BF1F1871  MAIN__                     38  int_sub_omp.f90
int_sub_omp.exe    00007FF7BF23F4FE  Unknown               Unknown  Unknown
int_sub_omp.exe    00007FF7BF23FEE4  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FF8FD3137E4  Unknown               Unknown  Unknown
ntdll.dll          00007FF8FE15CB61  Unknown               Unknown  Unknown

 

Adding '!$omp end parallel do ' after the loop does not change the runtime crash.

Adding 'private(s)' or 'firstprivate(s)' creates a run-time crash, which is not captured and no traceback is given.

You should file a bug in Intel's online support system.

 

ps: gfortran 10.2 build and runs fine on GNU/Linux

Ulrich_M_
New Contributor I
159 Views

Done, thanks for checking Johannes!

Reply