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

error #6401: The attributes of this name conflict with those made accessible by a USE statement. [X]

sarma_amras
New Contributor I
6,805 Views
Hi,

Can you please help me with this err

error #6401: The attributes of this name conflict with those made accessible by a USE statement.
I am getting this err when I try accessing a variable declared in MODULE ZF5 with the EQUIVALENCE statement.

Regards
Kameswara Sarma

0 Kudos
9 Replies
TimP
Honored Contributor III
6,805 Views
Quoting - sarma_amras

error #6401: The attributes of this name conflict with those made accessible by a USE statement.
I am getting this err when I try accessing a variable declared in MODULE ZF5 with the EQUIVALENCE statement.

According to my reading of Adams, Brainerd et al, the module array technically must be declared with SEQUENCE before it can be mentioned in EQUIVALENCE. If this is the problem, I suppose the error message ought to be more informative.
We have had problems in the past with ifort being unwilling to diagnose extensions beyond Fortran standard which aren't accepted by other compilers.
0 Kudos
Steven_L_Intel1
Employee
6,805 Views
I think the real problem here is that once you USE a module, you cannot change attributes of any of the symbols that came from the module, with minor exceptions. Here, you have a variable X in the module, and then EQUIVALENCE it to A in the main program. This is not allowed. You'll have to move A into the module as well if you want to do this.

You're not using derived types, so SEQUENCE is not applicable.
0 Kudos
TimP
Honored Contributor III
6,806 Views
I think the real problem here is that once you USE a module, you cannot change attributes of any of the symbols that came from the module, with minor exceptions. Here, you have a variable X in the module, and then EQUIVALENCE it to A in the main program. This is not allowed. You'll have to move A into the module as well if you want to do this.

You're not using derived types, so SEQUENCE is not applicable.
Unlike the Adams, Brainerd textbook, the standard is more explicit about the restriction against non-sequence types in EQUIVALENCE applying to derived types. I don't find the explicit statement about the requirement Steve mentions, although I'm not surprised by it.
0 Kudos
Steven_L_Intel1
Employee
6,806 Views
11.2.1, p252:

30 The local identifier of an entity made accessible by a USE statement shall not appear in any other
31 nonexecutable statement that would cause any attribute (5.1.2) of the entity to be specified in the
32 scoping unit that contains the USE statement, except that it may appear in a PUBLIC or PRIVATE
33 statement in the scoping unit of a module and it may be given the ASYNCHRONOUS or VOLATILE
34 attribute.

The text I cite above doesn't cover EQUIVALENCE, since that is not an attribute. However, there is this:

C585 (R556) The name of an equivalence-object shall not be a name made accessible by use association.
0 Kudos
sarma_amras
New Contributor I
6,806 Views
I think the real problem here is that once you USE a module, you cannot change attributes of any of the symbols that came from the module, with minor exceptions. Here, you have a variable X in the module, and then EQUIVALENCE it to A in the main program. This is not allowed. You'll have to move A into the module as well if you want to do this.

You're not using derived types, so SEQUENCE is not applicable.

Steve...I tried with both X(50) & A(50) included in the module statement as suggested.
But still the error is persisting with both the variables used.

error #6401: The attributes of this name conflict with those made accessible by a USE statement.

error #6401: The attributes of this name conflict with those made accessible by a USE statement.

I guess we cannot use equivalence keyword with the variables used in module statement.
Please suggest.
Kameswara Sarma

0 Kudos
sarma_amras
New Contributor I
6,806 Views
Quoting - tim18
According to my reading of Adams, Brainerd et al, the module array technically must be declared with SEQUENCE before it can be mentioned in EQUIVALENCE. If this is the problem, I suppose the error message ought to be more informative.
We have had problems in the past with ifort being unwilling to diagnose extensions beyond Fortran standard which aren't accepted by other compilers.

Tim ... can you please elaborate on the use of what you have suggested? Sarma
0 Kudos
Steven_L_Intel1
Employee
6,806 Views
Please show us your modified source. If you still have an EQUIVALENCE in the main program, that won't work.

Tim's comments on SEQUENCE don't apply to your program.
0 Kudos
sarma_amras
New Contributor I
6,806 Views
Please show us your modified source. If you still have an EQUIVALENCE in the main program, that won't work.

Tim's comments on SEQUENCE don't apply to your program.

I still have the Equivalence in the main program. But the variable used with Equivalence is also present in MODULE.
Can I use the Equivalence now. I still face the error. Please suggest
0 Kudos
Steven_L_Intel1
Employee
6,806 Views

You cannot have the EQUIVALENCE in the main program if any of the variables listed are module variables. If you are still having problems, please show us the new code.
0 Kudos
Reply