This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/34532] Doc error or rej.valid vendor extension: Integer as logical in IF expressions



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]