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

Using exit as parameter in a Module

smk_009
Beginner
632 Views

Hi,

I am using Intel 9.1 Compiler, and in one of my module I had defined a parameter with name exit like this

[bash]integer, parameter :: exit = 3[/bash]


With Compaq Visual Fortran compiler, this code used to compile fine, now with Intel compiler I am getting this error

bndymod.f(66) : Error: The attributes of this name conflict with those made accessible by a USE statement. [EXIT]

integer, parameter :: exit = 3

What might be the issue, Can't we define a parameter with name exit ?

- Manoj

0 Kudos
4 Replies
Arjen_Markus
Honored Contributor I
632 Views
The error means that there is another variable or parameter with the same name in
a module that your module is using. CVF did not check on that, IIRC, but Intel Fortran
is much more strict.

One possibility to solve this:

use module_that_contains_exit, exit_not_used => exit

to rename the conflicting variable/parameter.

Another solution, probably better, is to collect all these parameters in a single
module of their own.

Regards,

Arjen
0 Kudos
smk_009
Beginner
632 Views
Arjen,

Thanks for your response.

I had defined exit only in this module in my entire source and I had used ifport module. I found that by removing the ifport module from the module source I was able to compile the module successfully.

[bash]      module test
c
      use ifport
c
      implicit none
c
      integer, parameter :: b121        = 1
      integer, parameter :: b121_block  = 1
      integer, parameter :: b121_master = 2
      integer, parameter :: b121_slave  = 3
c
      integer, parameter :: inlet       = 2
c
      integer, parameter :: exit        = 3
c
c
      integer, parameter :: no_bc       = 6
c
      end module test[/bash]

So it means exit is defined in ifport module, Is there any way that I can use ifport without exit defined in it.

Is there is any way to find the multiply defined parameters in modules ?

- Manoj

0 Kudos
mecej4
Honored Contributor III
632 Views
Arjen told you how already: use the rename feature in the USE statement.

To be specific, replace

useifport

by

useifport, IFP_EXIT => EXIT

You can use any name instead of IFP_EXIT, as long as it is not used in the current scope.
0 Kudos
smk_009
Beginner
632 Views
Guys,

Thanks for your suggestions, I am able to compile the module successfully with these changes.

-Manoj
0 Kudos
Reply