This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34532] Doc error or rej.valid vendor extension: Integer as logical in IF expressions
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Dec 2007 07:57:59 -0000
- Subject: [Bug fortran/34532] Doc error or rej.valid vendor extension: Integer as logical in IF expressions
- References: <bug-34532-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from burnus at gcc dot gnu dot org 2007-12-20 07:57 -------
FX wrote:
> > http://gcc.gnu.org/onlinedocs/gfortran/Implicitly-convert-LOGICAL-and...
> I think this is only true for assignments, ie you can assign a logical
> value to an integer lhs and the other way around. The doc needs fixing.
And Steve Lionel of Intel wrote:
> Although the Intel compiler allows this (it is an extension dating
> back at least to VAX FORTRAN V1 in 1978 if not earlier), this is a
> VERY bad idea. The value of .TRUE. could be anything when converted
> to integer, and different compilers use different values. I know you
> were just trying things, but please don't write code like this for
> real. I would not encourage gfortran to pick up this extension - I'm
> lobbying to have it give a warning by default in ifort. If gfortran
> wants to pick it up, please make it off by default.
I agree that we should change only the documentation. gfortran supports - as FX
wrote:
logical l
integer i
i = .true.
l = 1
end
It prints by default a warning and rejects it with -std=f*.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34532