No, it understands the intention of the person who wrote the code but this is 
an error.

@ gfortran 7.4.0
if(a == b) then
1
Error: Logicals at (1) must be compared with .eqv. instead of ==
gfort_test.f:15:9:
if(a .eq. b) then
1
Error: Logicals at (1) must be compared with .eqv. instead of .eq.

As far as I remember,some time ago to make the fortran code which compiles with 
ifort compile with gfortran the good starting point was to switch on all flags 
which control the strict use of the standard, unfortunately I have no access to 
ifort  right now and can not check the proper combination, probably it was just 
"-std90".  
By default, ifort compiles the non-standard code it is able to understand while 
the  default gfortran behavior is to treat it as an error. This particular case 
is far beyond the standard, so I do not know if it is even possible to force 
gfortran to compile this code.

Sincerely,
Mikhail 




>Среда, 26 июня 2019, 8:43 +03:00 от "Fecher, Gerhard" <[email protected]>:
>
>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
>________________________________________
>Von: Wien [[email protected]] im Auftrag von Gavin Abo 
>[[email protected]]
>Gesendet: Mittwoch, 26. Juni 2019 03:37
>An:  [email protected]
>Betreff: Re: [Wien] gfortran compilation and run problems for 19.1
>
>The == should work for C/C++ language.  I don't recall ever seeing that being 
>used for Fortran.
>
>A quote from a HP Doctor Fortran article [  
>https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/274462
> ]:
>
>"The real trouble with making assumptions about the internal value of LOGICALs 
>is when you try testing them for "equality" against another logical 
>expression. The way many Fortran programmers would naturally do this is as 
>follows:
>
>IF (LOGVAL1 .EQ. LOGVAL2) ...
>
>but the results of this can vary depending on the internal representation. The 
>Fortran language defines two operators exclusively for use on logical values, 
>.EQV. ("equivalent to") and .NEQV. ("not equivalent to"). So the above test 
>would be properly written as:
>
>IF (LOGVAL1 .EQV. LOGVAL2) ..."
>
>On 6/25/2019 3:14 PM, Fecher, Gerhard wrote:
>
>Does == work ?
>
>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
>________________________________________
>Von: Wien 
>[[email protected]<mailto:[email protected]>]
> im Auftrag von Sam Trickey [[email protected]<mailto:[email protected]>]
>Gesendet: Dienstag, 25. Juni 2019 15:13
>An: [email protected]<mailto: [email protected] >
>Betreff: Re: [Wien] gfortran compilation and run problems for 19.1
>
>See below
>
>On 6/25/19 5:47 AM, Peter Blaha wrote:
>Hi,
>
>I can confirm the fix for   inputpars.F.   Of course, according to fortran 
>standards a logical if should have an .eqv. operator (although I never 
>"understood" what that should be good for ...).
>
>Keeps computer scientists occupied introducing needless and annoying 
>distinctions.
>
>peace, Sam
>
>
>--
>Samuel B. Trickey
>QTP, Depts. of Physics and Chemistry
>2324 Physics Building
>Box 118435
>Univ. of Florida
>Gainesville, FL 32611-8435
>Vox: 352-392-6978 (direct)
>Vox: 352-392-1597 (receptionist)
>Fax: 352-392-8722
>http://www.qtp.ufl.edu/ofdft
>http://users.clas.ufl.edu/trickey
>
>
>_______________________________________________
>Wien mailing list
>[email protected]
>http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
>SEARCH the MAILING-LIST at:  
>http://www.mail-archive.com/[email protected]/index.html


-- 
Mikhail Nestoklon
_______________________________________________
Wien mailing list
[email protected]
http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
SEARCH the MAILING-LIST at:  
http://www.mail-archive.com/[email protected]/index.html

Reply via email to