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

Is ifort (Linux) and Intel Visual Frotran compiler(Windows) compatible?

moghaddam
Beginner
781 Views
Hi All,

I have been able to compile my code using "Intel Visual Fortran Compiler for Windows", but I get error while compiling in Linux OS using ifort!

In specific, I have:
if( (logical_variable) .and. (mod(x,y).eq.0) ) then ...

where I get the error of :
A logical data type is required in this context.

while I didn't have nay problem with Intel Visual. I can not change the code as I am a user and need to compile it!

Appreciate your help in advance!

Sarvin

0 Kudos
6 Replies
TimP
Honored Contributor III
781 Views
Quoting - moghaddam@umbi.umd.edu

if( (logical_variable) .and. (mod(x,y).eq.0) ) then ...

where I get the error of :
A logical data type is required in this context.

while I didn't have nay problem with Intel Visual. I can not change the code as I am a user and need to compile it!

Do you mean that a declaration for your logical_variable was missed? There's no reason for ifort to interpret this differently on linux than on Windows, unless you have the legacy DEC option to allow mixing logical and integer set on Windows.
Even then, the Windows compiler should be able to tell you if the LOGICAL isn't specified, if you ask it to do so.
Unfortunately, I run into broken links, attempting to look up previous posts on the forum.
0 Kudos
moghaddam
Beginner
781 Views
Quoting - tim18
Do you mean that a declaration for your logical_variable was missed? There's no reason for ifort to interpret this differently on linux than on Windows, unless you have the legacy DEC option to allow mixing logical and integer set on Windows.
Even then, the Windows compiler should be able to tell you if the LOGICAL isn't specified, if you ask it to do so.
Unfortunately, I run into broken links, attempting to look up previous posts on the forum.

The code is compiled and can be excuted using the Visual Fortran so I should say in terms of logic is fine!

How should I use this "DEC" option? Should I have /DEC as one of my flags in my Make file in Linux?

I copied all the "All Options:" under ./Project/Properties/Configuration Propertis/Fortran/Command Line as flags in my Linux make file!

thanks in advance!
Sarvin

0 Kudos
Steven_L_Intel1
Employee
781 Views
There is no option in the compiler to do this. I suspect something else is going on. Can you supply a small but complete source that shows this error?
0 Kudos
moghaddam
Beginner
781 Views
There is no option in the compiler to do this. I suspect something else is going on. Can you supply a small but complete source that shows this error?

As I mentioned in my other post titled as: "flag for mixing integer and logical variables", I get the following weeor when I am trying to compile my code using ifort in Linux OS.

I have:
if ((dstep).and.(mod(nsteps,dstpat).eq.0)) then
where I get:
error 6341: A logical data type is required in this context.

Can it be a library isuue/

Thanks,
Sarvin
0 Kudos
TimP
Honored Contributor III
781 Views
Unlikely, show us the entire subroutine, or submit a problem report with it.
0 Kudos
Steven_L_Intel1
Employee
781 Views
It is not a library issue. You are not showing enough of the problem to know what it is. Please show a small but complete source that demonstrates the error and show the complete command you used to compile it. For example, I tried the following source but did not see a problem:

[plain]integer dstep
integer nsteps, dstpat
if ((dstep).and.(mod(nsteps,dstpat).eq.0)) then
  print *, "ok"
end if
end[/plain]
However, if I changed the declaration of dstep to REAL, I get this:

t.f90(3): error #6385: The highest data type rank permitted is INTEGER(KIND=8).
[DSTEP]
if ((dstep).and.(mod(nsteps,dstpat).eq.0)) then
-----^
t.f90(3): error #6385: The highest data type rank permitted is INTEGER(KIND=8).
if ((dstep).and.(mod(nsteps,dstpat).eq.0)) then
-----------^
t.f90(3): error #6341: A logical data type is required in this context.
if ((dstep).and.(mod(nsteps,dstpat).eq.0)) then
-----------^

This leads me to believe that your variable DSTEP is not integer but is either untyped (and hence implicitly real) or is a real type.

I will also comment that even if it DID compile, the results are probably not what you expect. If you are expecting 0 to be false and non-0 to be true, that's not what will happen. Please correct your program to NOT rely on numeric to logical conversion.
0 Kudos
Reply