This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: Mixed INTEGER and LOGICAL


Hi,

Steve Edwards schrieb:
>       logical ifstr
>       ifstr=.false.
>       write(6,1000)ifstr,ifstr
>  1000 format(L1,'      ',I1)
>
> Although the gfortran manual says it supports mixed logical and integer
> with the default -std=gnu this program fails with gfortran runtime
>   
Not that it makes any difference (it is currently not supported), but I
would expect such a support only for -std=legacy.

I don't know whether it makes sense to include it or not, but I want to
point out that
the "I1" also fails with NAG f95 and g95; moreover, it does not produce the
right result with the Intel Compiler for .true., which writes:
"*" as .true. is "-1".

In terms of support: I the manual only states that
  integer = logical
and
  logical = integer
work (conversion at compile time; gives a default warning).
It does not say explicitly that it also works for formatted IO
(read,write,print);
indeed it does not.

I filled a PR about this:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29784

Question to the other gfortraners: Should we implement it? If yes, as
STD_GNU or as STD_LEGACY?
If not, we probably should make it clear in section 7.11 of the manual
that we don't support this.
(If yes, we should also write something in the manual.)

> Incidentally, it worked fine with g77 3.4.6, IBM xlf, HP/UX fort77 and the Sun WorkShop Compiler.
Actually, using the Sun compiler assignments such as "logical = integer"
do not work. Thus this integer<->logical conversion is only half
supported by Sun.

Tobias


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