Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Undefined pointer/array *not crashing*

$
0
0

Hello everyone,

I'm having issues with this sample of code

subroutine tri_2D(vect)
	real(kind=DP), dimension(:,:),pointer :: vect

	integer :: n, n1, n2
	real(kind=DP), dimension(:), allocatable :: STOCK1, STOCK2
	real(kind=DP) :: temp1,temp2

	integer :: j, jj, jcompt, flag, jk

	integer :: nn,nntemp

	integer :: k,w

	integer :: markeur
	real(kind=DP),dimension(:), pointer :: ptr_temp

	! recuperation des dimensions de vect
	n1=size(vect,1)
	n2=size(vect,2)

!	write(unit=*,fmt=*) "n1=",n1,"n2=",n2
!	pause

	if (n2/=2) then
		write(unit=*,fmt=*) "erreur de dimension de vect, tri 2D : dim non égale a 2"
		return
	endif

	nn=n1
	allocate(stock1(nn),stock2(nn))

	do k=1,nn
		STOCK1(k)=vect(k,1)
		STOCK2(k)=vect(k,2)
	enddo

.........

Oddly, I declare these variables as "allocatable", so they should be allocated after the statement allocate, right ?

Except I get that "Undefined pointer/aray" (see attached picture). So I guess that it should crash when I affect a value in the "do loop" that follows ? But it doesn't. The debugger still goes through the code

 

Please advise. I can't figure out what's going on in my statements.

Regards,

Renaud Egal

AttachmentSize
Downloadundefined.png10.47 KB

Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>