Compiling Warnings..."type conversion of subscript..&qu


I have posted a picture of 2 main warning I keep getting. Although I use the flag “-Mlarge_arrays”…which I do since I am expecting the .exe to use memory exceeding 2GB, I still end up with this warning. I am not sure that they are even related, but it most likely is.

I am sorry this might be a hassle, could you please point me in the right direction?

Thank you

Hi Ahmed,

For the underflow warning, you most likely have a constant assignment. Constants use the default kind so is most likely a REAL(4) which isn’t able to represent the constant. Try adding “-r8” to change the default kind to REAL(8), or add “_8” to the end of the constant to change it’s kind.

For the type conversion, I’d like to know how “cog” and “coh” are declared and an example how they are being used.

  • Mat

Hey Mat,

Thank you for your replies.

  1. Neither _8 nor “-r8” have worked with the second warning. I am assuming that these constant values are truncated since it most likely is using REAL (4) ?

  2. “cog” and “coh” are assigned in the main program:
    and they are also
    and so appear in many subroutines throughout my code. These variables evaluate some really simple equations where their contents are all REAL and thus the cog and coh array is populated. This is in addition to an array in the code “amat” that is processed from “cog” and “coh”. (I have only 4GB ram on cpu, is an upgrade a must?)

I wonder if these arrays are too massive… (I am guessing not). Would I have to assign and allocate these two arrays in each subroutine?

I hope I am not losing you.


Hi Ahmed,

These arrays aren’t very big. So unless you have hundreds of them, you shouldn’t have any problems with memory.

Can you please post lines 4303 through 4316 and post the declaration of any other variable used?

  • Mat

This part of the subroutine starts at 4294 and ends at 4316

Variables in this subroutine are:
Double precision index
dimension amat(3ni,),bc(2,)
dimension inod(
dimension amat(3
dimension coH(4000000),coG(4000000)
data pi/3.141592653589793D0/
pi2 = pi*2.d0

While in the main program are:

	elseif(bc(1,3*jind-2).eq.2.and.bc(1,3*jind-1).eq.1.and.!Store coefficient
     +    bc(1,3*jind).eq.1) then
    	amat(3*i-2,3*j-2) = coH(Index*9+1)
	amat(3*i-1,3*j-2) =	coH(Index*9+4)
	amat(3*i,3*j-2)   =	coH(Index*9+7)
    	amat(3*i-2,3*j-1) = -coG(Index*9+2)
	amat(3*i-1,3*j-1) =	-coG(Index*9+5)
	amat(3*i,3*j-1)   =	-coG(Index*9+8)
    	amat(3*i-2,3*j)   = -coG(Index*9+3)
	amat(3*i-1,3*j)   =	-coG(Index*9+6)
	amat(3*i,3*j)     = -coG(Index*9+9)
	elseif(bc(1,3*jind-2).eq.1.and.bc(1,3*jind-1).eq.2.and.!Store coefficient
     +    bc(1,3*jind).eq.2) then
    	amat(3*i-2,3*j-2) = -coG(Index*9+1)
	amat(3*i-1,3*j-2) =	-coG(Index*9+4)
	amat(3*i,3*j-2)   =	-coG(Index*9+7)
    	amat(3*i-2,3*j-1) = coH(Index*9+2)
	amat(3*i-1,3*j-1) =	coH(Index*9+5)
	amat(3*i,3*j-1)   =	coH(Index*9+8)
    	amat(3*i-2,3*j)   = coH(Index*9+3)
	amat(3*i-1,3*j)   =	coH(Index*9+6)
	amat(3*i,3*j)     = coH(Index*9+9)

I hope this might be helpful to comprehend


There you see the source of the warning messages – subscripts are expected to be integer variables or expressions. Why did you declare ‘Index’ as a real type instead of an integer type?

Dear Mat

I really appreciate your help. I know these warning might seem immature to you and I apologize for that.

Migrating from an old compiler “powerstation” to PGI Workstation has made me content about what I can achieve. It is just a matter of time before I figure out all those default things that I took for granted on powerstation.

Your replies are always to the point, thank you again.



If I may ask… CPU_Time does not work with me and it worked with no problems on Powerstation.

Do you suggest a better subroutine to measure elapsed time in seconds to use with PGI?


Hi Ahmed,

Can you give more detail as to what you mean by “CPU_Time does not work”? Are you getting zero values? The clock resolution on Windows is fairly poor so your if your compute time is less then this resolution then it would produce zeros.

Some other timers you could investigate are the Fortran Standard “system_clock” call, the Lib3f “time”, “secnds”, “dsecnds” routines, or the OpenMP omp_get_wtime.

  • Mat

I am getting zeros although the .exe file took 1:30hrs to complete…
While the same compiled code from powerstation gives a .exe file that give the time elapsed no problem


	Real time, time0      
      call CPU_Time(time0)

!! code over here...

      call CPU_Time(time)
      write(3,20) time-time0      !'Total CPU time used =',time-time0,'(sec)'
      write(*,20) time-time0      !'Total CPU time used =',time-time0,'(sec)'
   20	format(' Total CPU time used  =',(f12.3),'(sec)')

Everything works great now.

I thank you for your patience again. You rock!