0

In my fortran77 project, I call the subroutine BDET in the subroutine MATS. However the get the following error:

Procedure <BDET> called with an implicit interface [-Werror=implicit-interface]

I don't understand why this happens! BDET subroutine is declared before MATS, why is the implicit interface problem happening here?

Any help is greatly appreciated (F77 newbie here). Thanks in advance.

      SUBROUTINE BDET(mat_A, DET)
C    This subroutine calculates the determinant of a 3x3 matrix
      IMPLICIT NONE
      REAL*8 DET
      REAL*8 mat_A(3,3)

      DET = mat_A(1,1) * mat_A(2,2) * mat_A(3,3) -
     1      mat_A(1,2) * mat_A(2,1) * mat_A(3,3)

      DET = DET + mat_A(1,2) * mat_A(2,3) * mat_A(3,1) +
     1       mat_A(1,3) * mat_A(2,1) * mat_A(3,2) -
     2       mat_A(1,1) * mat_A(2,3) * mat_A(3,2) -
     3       mat_A(1,3) * mat_A(2,2) * mat_A(3,1)
      RETURN
      END SUBROUTINE BDET

      SUBROUTINE MATS(DFGRD0,DFGRD1)

C  Implicitly declare variables and set character length
      IMPLICIT REAL*8 (A-H,O-Z)
      CHARACTER*80 CMNAME
      REAL*8 DFGRD1(3,3)

      REAL*8 Ibar1, Ibar2, J
      REAL*8 F(3,3)

      CALL BDET(F, J)

      RETURN
      END SUBROUTINE MATS
Ian Bush
  • 6,996
  • 1
  • 21
  • 27
Dexter
  • 43
  • 5
  • 1
    Because you haven't declared an explicit interface. – francescalus Aug 14 '23 at 07:39
  • 1
    (Note that all interfaces in F77 are implicit, so using `-Werror=implicit-interface` for F77 code is unhelpful. Fortunately, gfortran isn't a F77 compiler.) – francescalus Aug 14 '23 at 08:03
  • And fortunately the above is not Fortran77 code; code according to that standard should not have been written this millennium. And it's not just because of the non-standard, non-portable, should never be used real*8; ignoring that it's at least Fortran 90. – Ian Bush Aug 14 '23 at 08:57

0 Answers0