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

-wwarn interfaces and array from module

albert
Beginner
931 Views
Dear all,

I have the followind code:
============ mod.f =============
MODULE rr_mod
INTEGER :: nbuck(1)
END MODULE rr_mod
============ overlap.f ===========
SUBROUTINE overlap_fie (overlap)
USE rr_mod
IMPLICIT NONE
INTEGER ,OPTIONAL :: OVERLAP(0:NBUCK(1)-1)
overlap = 1
END SUBROUTINE
============== tst.f =============
SUBROUTINE tst
USE rr_mod
IMPLICIT NONE
INTEGER, DIMENSION(0:nbuck(1)-1):: iover

INTERFACE
SUBROUTINE overlap_fie (overlap)
USE rr_mod
INTEGER,OPTIONAL::OVERLAP(0:NBUCK(1)-1)
END SUBROUTINE overlap_fie
END INTERFACE
call overlap_fie (overlap=iover)
RETURN
END SUBROUTINE tst

====== compilation and output =======
$ ifort -c -warn interfaces mod.f
$ ifort -c -warn interfaces overlap.f
$ ifort -c -warn interfaces tst.f
tst.f(7): error #8000: There is a conflict between local interface block and external interface block. [OVERLAP]
SUBROUTINE overlap_fie (overlap)
--------------------------------^
compilation aborted for tst.f (code 1)

As far as I can see the problem results from the fact nbuck is an array andcomes through the module rr_mod.

Any suggestion how to overcome this problem (problem is stripped from a large code packag) ?

Best Regards,

Albert
0 Kudos
8 Replies
mecej4
Honored Contributor III
931 Views
An interface body has no awareness of external (to it) constants and variables (such as NBUCK) that one may imagine to be available by host association.

It is for this purpose that the IMPORT statement was created.
0 Kudos
Steven_L_Intel1
Employee
931 Views
In this case, NBUCK is visible through the USE RR_MOD.

I can't reproduce the problem using 12.0.2. Which compiler version are you using?
0 Kudos
albert
Beginner
931 Views
Hi Steve,

The Fortran compiler version: c11.1.059_f11.1.059

Best regards,

Albert
0 Kudos
Steven_L_Intel1
Employee
931 Views
Ok - we've made fixes in that area since then. Please try the current compiler. I think 12.0.3 is now posted.
0 Kudos
albert
Beginner
931 Views
I'll have a try next week, see if I can persuade our sys admin to install it (otherwise I'll see if I can install it localy)

Albert
0 Kudos
Steven_L_Intel1
Employee
931 Views
You can certainly do a local install of the compiler - I do that all the time.
0 Kudos
albert
Beginner
931 Views
I don't doubt that I can instal it, but what is the easiest way t down load the compiler (could not find a direct link to the instal package).

Albert
0 Kudos
TimP
Honored Contributor III
931 Views
https://registrationcenter.intel.com
If your license has been registerd by someone else, their credentials will be needed.
0 Kudos
Reply