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

Compiler error #8284

Grassi__Lorenzo
Beginner
2,997 Views

Hi everyone,

I am having a problem when compiling a code, and I hope I could get some help here.

The error I am getting is:

advance_crack.f(629): error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument
is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic.   [RCONP]
       call cut_tetra_11(elmtnr,xl,N0,fp,Ae,Ve,VepVe,Lcn,xl2d,

And here is the parts of the code which should be relevant to this issue. For the advance_crack.f file:

       subroutine  advance_11(tetln,ns,sflag,ndm,nen,numel,nen1,
     *x,xlen,ix,ixlen, hist,hlen,n1,n3,idtet,N0,fp,
     *pN0,pAe,pVe,pLcn,pVepVe,pXbar,pcini,pnodeflag,pcn,
     *pconp,pconm,pXl2d,pNold,pNelem)

       implicit none

...

       real*8   VepVe, Lcn(4,4), rconp, rconm, xl2d(2,4)

...

       call cut_tetra_11(elmtnr,xl,N0,fp,Ae,Ve,VepVe,Lcn,xl2d,
     *xn3d,idtemp, cn,rconp,rconm)
...
       Hist(1+(elmtnr-1)*nn+tn1+pconp) = rconp

The cut_tetra_11 subroutine looks like this:

       subroutine cut_tetra_11(elmtnr,xl,N0,xbs,Ae,Ve,fact,Lcn,
     *node_f,xn_f,id,k_f,rconp,rconm)

       implicit none

...

       real*8 jp(8), jm(8),rconp(7),rconm(7)

       call array_to_real_11(conp,rconp)

Finally, the array_to_real_11 subroutine looks like this:

       subroutine array_to_real_11(con,rcon)

       implicit none

       integer con(7), icon,  i
       real*8  rcon
       icon = 0
       do i= 1,7
       icon = icon + con(8-i)*10**(i-1)
       enddo
       rcon = Dfloat(icon)
       end

  Hope my description of the issue is clear enough. I should also add that I had a look at previous entries in this forum for error #8284. Following previous threads, I tried to changed the

       call cut_tetra_11(elmtnr,xl,N0,fp,Ae,Ve,VepVe,Lcn,xl2d,
     *xn3d,idtemp, cn,rconp,rconm)

to

       call cut_tetra_11(elmtnr,xl,N0,fp,Ae,Ve,VepVe,Lcn,xl2d,
     *xn3d,idtemp, cn,rconp(1),rconm(1))

That got rid of error #8284, but then I obtained the following error, instead:

advance_crack.f(654): error #6423: This name has already been used as an external function name.   [RCONP]
       Hist(1+(elmtnr-1)*nn+tn1+pconp) = rconp

Every help is very welcome. Thanks in advance,

Lorenzo

0 Kudos
1 Solution
Juergen_R_R
Valued Contributor II
2,997 Views

Hi Lorenzo,

you give unfortunately not enough of your code in order to fully see what is going on. Clearly in the first case, rconp and rconm are defined inside advance_11 as being scalar (real*8). Then you call subroutine cut_tetra_11 with them as last two variables, but in the subroutine cut_tetra_11 they are declared as 7-component real*8 arrays. So that can't work. In your second try you called cut_tetra_11 with final arguments rconp(1),rconm(1), and now both is wrong. Inside the calling subroutine it is still defined as a scalar (i.e. not an array, whose first component you have been taking), while still cut_tetra_11 expects an array and not a scalar. Either define both as 7-component arrays, or both as scalar, or have it 7-component array in advance_11, scalar in cut_tetra_11 and then call just rconp(1), rconm(1). Several more things: real*8 as a kind-type for real constants are not portable, i.e. they might not have the precision on all systems. It is better to either use the old-school double precision or define your own kind-type parameters using selected_real_kind. Particular in the declaration

real*8 rcon
[...]
rcon = Dfloat (icon)

you show that you expect rcon to be double precision using the Dfloat intrinsincs. On most systems real*8 will probably be double precision, but there is no guarantee.

Next: in your subroutine it might help tremendously to give complete argument declarations, including the complete intent, i.e. in, out, inout.

 

View solution in original post

0 Kudos
6 Replies
Juergen_R_R
Valued Contributor II
2,998 Views

Hi Lorenzo,

you give unfortunately not enough of your code in order to fully see what is going on. Clearly in the first case, rconp and rconm are defined inside advance_11 as being scalar (real*8). Then you call subroutine cut_tetra_11 with them as last two variables, but in the subroutine cut_tetra_11 they are declared as 7-component real*8 arrays. So that can't work. In your second try you called cut_tetra_11 with final arguments rconp(1),rconm(1), and now both is wrong. Inside the calling subroutine it is still defined as a scalar (i.e. not an array, whose first component you have been taking), while still cut_tetra_11 expects an array and not a scalar. Either define both as 7-component arrays, or both as scalar, or have it 7-component array in advance_11, scalar in cut_tetra_11 and then call just rconp(1), rconm(1). Several more things: real*8 as a kind-type for real constants are not portable, i.e. they might not have the precision on all systems. It is better to either use the old-school double precision or define your own kind-type parameters using selected_real_kind. Particular in the declaration

real*8 rcon
[...]
rcon = Dfloat (icon)

you show that you expect rcon to be double precision using the Dfloat intrinsincs. On most systems real*8 will probably be double precision, but there is no guarantee.

Next: in your subroutine it might help tremendously to give complete argument declarations, including the complete intent, i.e. in, out, inout.

 

0 Kudos
mecej4
Honored Contributor III
2,997 Views

You made things worse for yourself by replacing rconp by rconp(1) in the argument list to cut_tetra_11.

If the declaration of rconp in the caller does not declare it as an array, the compiler will consider rconp(1) as an expression involving a call to a function with an integer argument, instead of an element of an array as you may have wanted. For this reason, it is troublesome to be ambivalent about whether a variable is a scalar or an array.

0 Kudos
Grassi__Lorenzo
Beginner
2,997 Views

Thanks to both Juergen and Mecej4 for the help with my issue.

After reading your advice carefully and reviewing the code, I came to the conclusion that the error was in cut_tetra_11 declaring rconm and rconp as 7-component real*8 arrays. That was indeed not needed for that subroutine, and declaring rconm and rconp consistently as real*8 scalars in all subroutines solved the issue.

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,997 Views

Juergen,

This was the first post that I have seen from you. I wish to congratulate you on the quality of your post. Keep up the good work.

Jim Dempsey

0 Kudos
Juergen_R_R
Valued Contributor II
2,997 Views

 

jimdempseyatthecove wrote:

Juergen,

This was the first post that I have seen from you. I wish to congratulate you on the quality of your post. Keep up the good work.

Jim Dempsey

Thanks for the flowers. Jim. But it isn't my first post. I'm using Fortran since almost two decades now, but still I don't understand as much of it as I would like to. But I keep trying. 

0 Kudos
jimdempseyatthecove
Honored Contributor III
2,997 Views

>> I'm using Fortran since almost two decades now...

Your still quite new at Fortran. I am at 48 years of Fortran....

>>but still I don't understand as much of it as I would like to. But I keep trying. 

Me to.

Jim Dempsey

0 Kudos
Reply