public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* G77: bitwise .AND. ?
@ 2002-04-23 11:55 Hassan Aurag
  2002-04-23 14:32 ` Toon Moene
  0 siblings, 1 reply; 7+ messages in thread
From: Hassan Aurag @ 2002-04-23 11:55 UTC (permalink / raw)
  To: gcc-help

 Hi,


 this is a small question. On IBM with xlf, if I do

	a = b .and. ( c .xor. TRUE ) 

 where TRUE = X'01010101', and a, b, c logical*4's equivalenced to 4
logical*1's, I'd get the correct info in a, eg:

 a = X'01000100' for example.

 But here, I'd only get the boolean .AND. result so for example
X'00000001'.

 Any options or ways of making g77 behave in the same way?


 Thanks in advance for any help





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G77: bitwise .AND. ?
  2002-04-23 11:55 G77: bitwise .AND. ? Hassan Aurag
@ 2002-04-23 14:32 ` Toon Moene
  2002-04-24  7:25   ` Hassan Aurag
  0 siblings, 1 reply; 7+ messages in thread
From: Toon Moene @ 2002-04-23 14:32 UTC (permalink / raw)
  To: Hassan Aurag; +Cc: gcc-help

Hassan Aurag wrote:

>  this is a small question. On IBM with xlf, if I do
> 
>         a = b .and. ( c .xor. TRUE )
> 
>  where TRUE = X'01010101', and a, b, c logical*4's equivalenced to 4
> logical*1's, I'd get the correct info in a, eg:
> 
>  a = X'01000100' for example.
> 
>  But here, I'd only get the boolean .AND. result so for example
> X'00000001'.
> 
>  Any options or ways of making g77 behave in the same way?

Please supply a complete, compilable example and I'll try to answer this
question.

Thanks,

-- 
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
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G77: bitwise .AND. ?
  2002-04-23 14:32 ` Toon Moene
@ 2002-04-24  7:25   ` Hassan Aurag
  2002-04-24 14:32     ` Toon Moene
  0 siblings, 1 reply; 7+ messages in thread
From: Hassan Aurag @ 2002-04-24  7:25 UTC (permalink / raw)
  To: Toon Moene; +Cc: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Here you go:

if you compile the attached file on Linux using 'g77 -fugly-logint' and
run it, you get:

T F F F

On AIX (RISC) with 'xlf -qintlog', you get:

T F T F

Thanks in advance

On Tue, 2002-04-23 at 17:23, Toon Moene wrote:
> Hassan Aurag wrote:
> 
> >  this is a small question. On IBM with xlf, if I do
> > 
> >         a = b .and. ( c .xor. TRUE )
> > 
> >  where TRUE = X'01010101', and a, b, c logical*4's equivalenced to 4
> > logical*1's, I'd get the correct info in a, eg:
> > 
> >  a = X'01000100' for example.
> > 
> >  But here, I'd only get the boolean .AND. result so for example
> > X'00000001'.
> > 
> >  Any options or ways of making g77 behave in the same way?
> 
> Please supply a complete, compilable example and I'll try to answer this
> question.
> 
> Thanks,
> 
> -- 
> 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
> Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


[-- Attachment #2: ands.f --]
[-- Type: text/x-fortran, Size: 389 bytes --]

        program parallel
        logical*4 l4, ll4
        logical*1 l1(4), ll1(4)
        logical*4 true /X'01010101'/
        integer i
        equivalence(l1, l4), (ll1, ll4)

        ll1(1) = .true.
        ll1(3) = .true.

        l4 = ll4 .and. true

        do i =1, 4
                print *, l1(i)
        enddo
        end
       

        

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G77: bitwise .AND. ?
  2002-04-24  7:25   ` Hassan Aurag
@ 2002-04-24 14:32     ` Toon Moene
  2002-04-26 11:47       ` Hassan Aurag
  0 siblings, 1 reply; 7+ messages in thread
From: Toon Moene @ 2002-04-24 14:32 UTC (permalink / raw)
  To: Hassan Aurag; +Cc: gcc-help

Hassan Aurag wrote:

> if you compile the attached file on Linux using 'g77 -fugly-logint' and
> run it, you get:
> 
> T F F F
> 
> On AIX (RISC) with 'xlf -qintlog', you get:
> 
> T F T F

I think the problem is that g77 considers

      l4 = ll4 .and. true

a logical expression - which will have the value 0 or 1 - because all
the elements are logicals (so in spite of the -fugly-logint).

I don't know an easy way out of this, unfortunately.

-- 
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
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G77: bitwise .AND. ?
  2002-04-24 14:32     ` Toon Moene
@ 2002-04-26 11:47       ` Hassan Aurag
  2002-04-27  3:32         ` Toon Moene
  0 siblings, 1 reply; 7+ messages in thread
From: Hassan Aurag @ 2002-04-26 11:47 UTC (permalink / raw)
  To: Toon Moene; +Cc: Hassan Aurag, gcc-help, Remi Simard

Ok the problem below is fixed by doing

and(ll4, true) instead of ll4.and.true


In my opinion, this is a bug in G77.



On Wed, 2002-04-24 at 17:31, Toon Moene wrote:
> Hassan Aurag wrote:
> 
> > if you compile the attached file on Linux using 'g77 -fugly-logint' and
> > run it, you get:
> > 
> > T F F F
> > 
> > On AIX (RISC) with 'xlf -qintlog', you get:
> > 
> > T F T F
> 
> I think the problem is that g77 considers
> 
>       l4 = ll4 .and. true
> 
> a logical expression - which will have the value 0 or 1 - because all
> the elements are logicals (so in spite of the -fugly-logint).
> 
> I don't know an easy way out of this, unfortunately.
> 
> -- 
> 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
> Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: G77: bitwise .AND. ?
  2002-04-26 11:47       ` Hassan Aurag
@ 2002-04-27  3:32         ` Toon Moene
  0 siblings, 0 replies; 7+ messages in thread
From: Toon Moene @ 2002-04-27  3:32 UTC (permalink / raw)
  To: Hassan Aurag; +Cc: Hassan Aurag, gcc-help, Remi Simard

Hassan Aurag wrote:

> Ok the problem below is fixed by doing
> 
> and(ll4, true) instead of ll4.and.true
> 
> In my opinion, this is a bug in G77.

Yes, it could be argued that if we want to support -fugly-logint that
the code you supplied should work as-is.

Could you file a bug report using GNATS ?

Thanks in advance,

-- 
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
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: G77: bitwise .AND. ?
@ 2002-04-29 13:06 Hassan Aurag
  0 siblings, 0 replies; 7+ messages in thread
From: Hassan Aurag @ 2002-04-29 13:06 UTC (permalink / raw)
  To: 'Toon Moene', Hassan Aurag; +Cc: Hassan Aurag, gcc-help, Remi Simard

 I'll do that. It is also the same with OR and someone told me even
XOR??!!!!


-----Original Message-----
From: Toon Moene [mailto:toon@moene.indiv.nluug.nl]
Sent: Friday, April 26, 2002 4:02 PM
To: Hassan Aurag
Cc: Hassan Aurag; gcc-help@gcc.gnu.org; Remi Simard
Subject: Re: G77: bitwise .AND. ?


Hassan Aurag wrote:

> Ok the problem below is fixed by doing
> 
> and(ll4, true) instead of ll4.and.true
> 
> In my opinion, this is a bug in G77.

Yes, it could be argued that if we want to support -fugly-logint that
the code you supplied should work as-is.

Could you file a bug report using GNATS ?

Thanks in advance,

-- 
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
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-04-27 20:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23 11:55 G77: bitwise .AND. ? Hassan Aurag
2002-04-23 14:32 ` Toon Moene
2002-04-24  7:25   ` Hassan Aurag
2002-04-24 14:32     ` Toon Moene
2002-04-26 11:47       ` Hassan Aurag
2002-04-27  3:32         ` Toon Moene
2002-04-29 13:06 Hassan Aurag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).