- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
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!
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unlikely, show us the entire subroutine, or submit a problem report with it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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.
[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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page