<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font color="#000099">Interesting, it does compile and run with
ifort but does not compile with gfortran. The -stand option
could be used with ifort so that it gives a compiler message
similar to gfortran [
<a class="moz-txt-link-freetext" href="https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-stand">https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-stand</a>
]:</font><br>
</p>
<p>username@computername:~/Desktop/test$ cat logicaltest.f<br>
program logicaltest<br>
implicit none <br>
!<br>
! test ==, .eq., .eqv.<br>
!<br>
logical a, b, c<br>
<br>
a=.true.<br>
b=.true.<br>
<br>
if(a == b) then<br>
write(6,*) 'a == b'<br>
end if<br>
<br>
if(a .eq. b) then<br>
write(6,*) 'a .eq. b'<br>
end if<br>
<br>
if(a .eqv. b) then<br>
write(6,*) 'a .eqv. b'<br>
end if<br>
<br>
end</p>
<p>username@computername:~/Desktop/test$ ifort -v<br>
ifort version 19.0.4.243<br>
username@computername:~/Desktop/test$ ifort logicaltest.f -o
logicaltest<br>
username@computername:~/Desktop/test$ ./logicaltest<br>
a == b<br>
a .eq. b<br>
a .eqv. b</p>
<p><br>
username@computername:~/Desktop/test$ gfortran --version<br>
GNU Fortran (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0<br>
Copyright (C) 2017 Free Software Foundation, Inc.<br>
This is free software; see the source for copying conditions.
There is NO<br>
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.</p>
<p>username@computername:~/Desktop/test$ gfortran logicaltest.f -o
logicaltest<br>
logicaltest.f:11:10:<br>
<br>
if(a == b) then<br>
1<br>
Error: Logicals at (1) must be compared with .eqv. instead of ==<br>
logicaltest.f:15:10:<br>
<br>
if(a .eq. b) then<br>
1<br>
Error: Logicals at (1) must be compared with .eqv. instead of .eq.</p>
<p><br>
</p>
<p>username@computername:~/Desktop/test$ ifort logicaltest.f -o
logicaltest -stand<br>
logicaltest.f(1): warning #7373: Fixed form source is an
obsolescent feature in Fortran 2008.<br>
program logicaltest<br>
^<br>
logicaltest.f(11): warning #6297: Fortran 2008 does not allow a
LOGICAL data type in this context. [A]<br>
if(a == b) then<br>
----------^<br>
logicaltest.f(11): warning #6297: Fortran 2008 does not allow a
LOGICAL data type in this context. [B]<br>
if(a == b) then<br>
---------------^<br>
logicaltest.f(15): warning #6297: Fortran 2008 does not allow a
LOGICAL data type in this context. [A]<br>
if(a .eq. b) then<br>
----------^<br>
logicaltest.f(15): warning #6297: Fortran 2008 does not allow a
LOGICAL data type in this context. [B]<br>
if(a .eq. b) then<br>
-----------------^<br>
<br>
<br>
</p>
<div class="moz-cite-prefix">On 6/25/2019 11:42 PM, Fecher, Gerhard
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:b95fd79ed7a24c03b2fa96494d23a8af@uni-mainz.de">
<pre class="moz-quote-pre" wrap="">Dear Gavin,
Sorry my question was probably to short, it should read
Does anyone know whether "== " works with gfortran ?
With ifort the following test works well, but I cannot test it with gfortran
The answer in the Intel forum that you quote does not include "=="
program logicaltest
implicit none
!
! test ==, .eq., .eqv.
!
logical a, b, c
a=.true.
b=.true.
if(a == b) then
write(6,*) 'a = b'
end if
if(a .eq. b) then
write(6,*) 'a .eq. b'
end if
if(a .eqv. b) then
write(6,*) 'a .eqv. b'
end if
end
Ciao
Gerhard
DEEP THOUGHT in D. Adams; Hitchhikers Guide to the Galaxy:
"I think the problem, to be quite honest with you,
is that you have never actually known what the question is."
====================================
Dr. Gerhard H. Fecher
Institut of Inorganic and Analytical Chemistry
Johannes Gutenberg - University
55099 Mainz
and
Max Planck Institute for Chemical Physics of Solids
01187 Dresden</pre>
</blockquote>
</body>
</html>