Silverfrost Forums

Welcome to our forums

IMPORT statement produces confusing error message

5 Feb 2022 2:14 #28755

The IMPORT statement was added in F2003, so it is understandable that FTN95 will issue an error message when it encounters that statement in a source file that it is asked to compile. The error message wording, however, is somewhat confusing. In the following example, the IMPORT statement allows the kind parameter DOUBLE to be declared once and reused in a number of interface blocks where it is needed.

Module fcn_INT
   implicit none
   Integer, Parameter :: DOUBLE = kind(0.0d0)

   abstract INTERFACE
      Subroutine NLEfcn (N, X, FVEC, iflag)
         import :: DOUBLE
         implicit none
         Integer, Intent (In) :: N
         Integer :: iflag  ! set only to terminate
         Real (DOUBLE), Dimension (N), Intent (In) :: X
         Real (DOUBLE), Dimension (N), Intent (Out) :: FVEC
      End Subroutine
   End Interface

   abstract INTERFACE
      Subroutine NLSfcn (M, N, X, FVEC, IFLAG)
         import :: DOUBLE
         implicit none
...
      End Subroutine
   End Interface

End Module

The error message is

[FTN95/Win32 Ver. 8.83.0 Copyright (c) Silverfrost Ltd 1993-2021]
    PROCESSING MODULE  [<FCN_INT> FTN95/Win32 v8.83.0]
ERROR T:\MinPack\Netlib\V90\fcn_INT.F90 8:  Statement ordering error - IMPLICIT NONE cannot appear after type definition

Abstract interfaces were also not present in F95, so FTN95 would probably issue an error message for those lines of code if it gets to the point of parsing those lines.

7 Feb 2022 8:19 #28758

mecej4

Many thanks for the bug report. I have logged this for fixing.

A temporary work-around may be to use OPTIONS(IGNORE 299). This fixes the immediate failure but I have not tested it in a working program.

10 Feb 2022 11:31 #28768

This bug has now been fixed for the next release.

At the moment, if the IMPORT statement is omitted, FTN95 does not report an error (it uses the given parameter in the outer scope when it shouldn't). This issue remains outstanding.

10 Oct 2022 10:52 #29423

If IMPORT is omitted, FTN95 only reports an error when /ISO is applied.

This means that, as an extension to the Standard, FTN95 allows IMPORT to be omitted in this context.

I am not sure that this is ideal but a change might break existing code.

Please login to reply.