This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PATCH: Potential patch for PR fortran/6491
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Ian Lance Taylor <ian at wasabisystems dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 12 Jan 2004 23:51:33 +0100
- Subject: Re: PATCH: Potential patch for PR fortran/6491
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <20040112191944.29922.qmail@gossamer.airs.com>
Ian Lance Taylor wrote:
PR 6491 requires that a .and. of two logical*4 variables, when using
-fugly-logint, be implemented using an integer AND operation. The
result is then assigned to a logical*4 variable.
PR 12633 requires that the result of a .or. of two logical variables,
when using -fugly-logint, produce a logical result.
Hmmm, that's not how I understand it. The problem is that, with
-fugly-logint, LOGICALs should be treated as INTEGERs in expressions
that are assigned to (INTEGERs), while being treated as LOGICALs in
"logical" expressions (i.e., when a .true./.false. value is expected).
I.e.,
LOGICAL LA, LB
INTEGER I
...
I = LA .OR. LB ! I is set to the bitwise OR of LA and LB
whereas
LOGICAL LA, LB
...
IF (LA .OR. LB) THEN
.... ! Executed when either LA or LB is .true.
IOW, the way to evaluate the expression depends on its context - that's
why it's so hard to implement in g77, because that's counter to the way
Fortran is defined.
Nevertheless, it could be your patch just does The Right Thing.
Unfortunately, I'm too tired to look into it right now.
Hope this helps,
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)