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

compiler error #6351: The number of subscripts is incorrect

milenko1976
Beginner
5,618 Views
This is a liitle bit tricky.
integer*4 i,idrpar
do 2 i=1,nro
if(inewformat.eq.0)then
do idrpar=1,6
if(lderivp(idrpar,i).eq.1)lderivp(i)=1
enddo
indro(i)=i
iro=i
else if(inewformat.eq.1)then
icharirg=iaa(rcc(i))
do idrpar=1,6
if(lderiv(idrpar,icharirg).eq.1)lderiv(icharirg)=1
enddo
indro(i)=icharirg
iro=icharirg
endif

re2.f(87): error #6351: The number of subscripts is incorrect. [LDERIVP]
if(lderivp(idrpar,i).eq.1)lderivp(i)=1
------------------------------------^
re2.f(94): error #6351: The number of subscripts is incorrect. [LDERIV]
if(lderiv(idrpar,icharirg).eq.1)lderiv(icharirg)=1
----------------^

Anybody has idea?
0 Kudos
7 Replies
mecej4
Honored Contributor III
5,618 Views
There is nothing 'tricky' that I can see.

You have not shown the declaration of variable lderiv, so there is not much that one can say at this point, other than to recommend compiling with IMPLICIT NONE added to your sources and adding any needed type and dimension declarations.
0 Kudos
jimdempseyatthecove
Honored Contributor III
5,618 Views
re2.f(87): error #6351: The number of subscripts is incorrect. [LDERIVP]
if(lderivp(idrpar,i).eq.1)lderivp(i)=1
===
if(
lderivp(idrpar,i) .eq.1)
lderivp(i)
=1

You use 2 subscripts on lderivpin one place and 1 subscript onlderivp in the second place
Same with lderiv in

if(lderiv(idrpar,icharirg).eq.1)lderiv(icharirg)=1

You have inconsistent use of subscripts, and therefore a typographical or fundamental programming error.

Jim Dempsey
0 Kudos
milenko1976
Beginner
5,618 Views
Thanks Jim.But how to solve this?
0 Kudos
milenko1976
Beginner
5,618 Views
Jim is right,on extra p is problem.
0 Kudos
jimdempseyatthecove
Honored Contributor III
5,618 Views
Quoting milenko1976
Thanks Jim.But how to solve this?


You have to read your code, understand what the writer (you? someone else?) intended it to perform, and then make the corrections. I (we) do not have sufficient information as to the intentions of the programmer to make this decision

re2.f(87): error #6351: The number of subscripts is incorrect. [LDERIVP]

if(lderivp(idrpar,i).eq.1)lderivp(i)=1

------------------------------------^

The above indicates that lderivp has two subscripts but only one is supplied. There is insufficient information for me to determine which of:

a) what the other subscript should be
or
b) is "lderivp(i)=1" mistakenly used in place of a different variable name


re2.f(94): error #6351: The number of subscripts is incorrect. [LDERIV]

if(lderiv(idrpar,icharirg).eq.1)lderiv(icharirg)=1

----------------^

The above is similar, excepting you have a single subscript array being indexed using two subscripts.

We have insufficient information to determine if the additional subscript is in error (or which is in error) or if the variable name is in error.

Read the source of the program, or if you typed this in by an example you read somewhere, check for typing errors as you have an inconsistency of use error.

Jim Dempsey

0 Kudos
Paras_M_
Beginner
5,618 Views

DIMENSION DYNAM(70,LP1*LP2*LP3,30)

WRITE(IOCODE,*)II,JJ,KK
DO K=1,KK
DO J=1,JJ
DO I=1,II
IP=I+(J-1)*JJ+(K-1)*JJ*II
DYNAM(IP,1)=I
DYNAM(IP,2)=J
DYNAM(IP,3)=K
DYNAM(IP,4)=TX(I,J,K)
DYNAM(IP,5)=TY(I,J,K)
DYNAM(IP,6)=TZ(I,J,K)
DYNAM(IP,7)=PDAT(I,J,K)
DYNAM(IP,8)=TX(I,J,K)*TY(I,J,K)*
& TZ(I,J,K)
DYNAM(IP,9)=VISO(I,J,K)
DYNAM(IP,10)=VISW(I,J,K)
DYNAM(IP,11)=VISG(I,J,K)
DYNAM(IP,12)=CT(I,J,K)
DYNAM(IP,13)=BO(I,J,K)
DYNAM(IP,14)=BW(I,J,K)
DYNAM(IP,15)=BG(I,J,K)
DYNAM(IP,16)=RHOO(I,J,K)
DYNAM(IP,17)=RHOW(I,J,K)
DYNAM(IP,18)=RHOG(I,J,K)
DYNAM(IP,19)=PBOT(I,J,K)
DYNAM(IP,20)=QO(I,J,K)
DYNAM(IP,21)=QW(I,J,K)
DYNAM(IP,22)=QG(I,J,K)
DYNAM(IP,23)=SON(I,J,K)
DYNAM(IP,24)=SWN(I,J,K)
DYNAM(IP,25)=SGN(I,J,K)
DYNAM(IP,26)=P(I,J,K)
DYNAM(IP,27)=CUMO(J,K)+QOO*DELT*0.001
DYNAM(IP,28)=CUMW(J,K)+QWW*DELT*0.001
DYNAM(IP,29)=CUMG(J,K)+QGG*DELT*0.001
C DYNAM(IP,27)=KRG(I,J,K)
c DYNAM(IP,28)=KROG(I,J,K)
c DYNAM(IP,29)=PCOW(I,J,K)
c DYNAM(IP,30)=PCGO(I,J,K)
ENDDO
ENDDO
ENDDO
WRITE(IOCODE,111)
111 FORMAT(/TR2,'IP',TR2,'I',TR2,'J',TR2,'K',TR8,'TX',
& TR8,'TY',TR11,'TZ',TR10,'PDAT',TR8,'TOTRANS',
& TR7,'VISO',TR10,'VISW',TR8,'VISG',TR10,'CT',TR10,'BO',
& TR11,'BW',TR11,'BG',TR10,'RHOO',TR10,'RHOW',TR10,'RHOG',
& TR10,'PBOT',TR10,'QO',TR10,'QW',TR10,'QG',TR10,'SO',
& TR11,'SW',TR11,'SG',TR10,'Pressure'/1X,310('-')/)


DO IP=1,KK*JJ*II
C WRITE(IOCODE,'(4I3,26(1X,E12.4))')IP,'I J K'

WRITE(IOCODE,'(4I3,30(1X,E12.4))')IP,INT(DYNAM(IP,1)),
&INT(DYNAM(IP,2)),INT(DYNAM(IP,3)),(DYNAM(IP,IQ),IQ=4,30)

ENDDO

Error6351: The number of subscript is incorrect. [DYNAM]

0 Kudos
mecej4
Honored Contributor III
5,618 Views

Here is your declaration of DYNAMP:

[fortran]DIMENSION DYNAM(70,LP1*LP2*LP3,30)[/fortran]

How many subscripts are there in this declaration? Do they match the number of subscripts in all subsequent occurrences of the same variable in the subprogram?

0 Kudos
Reply