RSHIFT
Tim Prince
tprince@computer.org
Mon Feb 19 07:28:00 GMT 2001
Running on cygwin, both with their current compiler release, and with last
week's gcc-2.97, I get the result you quote. In 'info g77' it is pointed
out that the result of RSHIFT() as implemented in g77 is undefined in cases
involving signedness, and that you should use the standard function ISHFT()
in such cases. In your example, this changes the results you have marked.
I replace rshift(iii,2) by ishft(iii,-2).
----- Original Message -----
From: "KATAYAMA Jiro" <katayama@nesi.co.jp>
To: <gcc-bugs@gcc.gnu.org>
Sent: Sunday, February 18, 2001 8:08 PM
Subject: RSHIFT
> It seems RSHIFT does not work correctly.
>
> I try to check it by using newest version, but I cannot find where it is.
> g77 on Win2k is from cygwin; on WinNT from
> http://www.geocities.com/Athens/Olympus/5564/
>
> regards,
> jiro
>
> ---------------------------------------------------------------------
>
> program shftchk
> implicit none
> integer (kind=1) i,iii,iiiR
> logical f01(0:31)
>
> iii=ior(2**31,32)
> do i=0,31
> f01(i)=btest(iii,i)
> end do
> print *,(f01(i),i=31,0,-1)
>
> iiiR=rshift(iii,2);
>
> do i=0,31
> f01(i)=btest(iiiR,i)
> end do
> print *,(f01(i),i=31,0,-1)
> print *,'^ ^'
> end
>
> ----------------------------------------------------------------------
> option: -ffree-form
> ----------------------------------------------------------------------
> result:
> T F F F F F F F F F F F F F F F F F F F F F F F F F T F F F F F
> T T T F F F F F F F F F F F F F F F F F F F F F F F F F T F F F
> ^ ^
> ----------------------------------------------------------------------
>
> [WindowsNT4.0 + service pack #5 / ThinkPad600]
> g77 version egcs-2.91.57 19980901 (egcs-1.1 release) (from FSF-g77 version
> 0.5.24-19980804)
> gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
>
>
> [Windows2000 + service pack #1 / Dell Precision420]
> g77 version 2.95.2 19991024 (release-2) (from FSF-g77 version 0.5.25
19991024
> (release))
> Driving: g77 -v -c -xf77-version /dev/null -xnone
> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/specs
> gcc version 2.95.2 19991024 (release-2)
> ..
> GNU CPP version 2.95.2 19991024 (release-2) (80386, BSD syntax)
> ..
> GNU F77 version 2.95.2 19991024 (release-2) (i686-pc-cygwin) compiled by
GNU C
> version 2.95.2 19991024 (release-2).
> GNU Fortran Front End version 0.5.25 19991024 (release)
> ..
> __G77_LIBF77_VERSION__: 0.5.25 19991024 (release)
> @(#)LIBF77 VERSION 19990503
> __G77_LIBI77_VERSION__: 0.5.25 19991024 (release)
> @(#) LIBI77 VERSION pjw,dmg-mods 19990503
> __G77_LIBU77_VERSION__: 0.5.25 19991024 (release)
> @(#) LIBU77 VERSION 19980709
>
> ---------------------------------------------------------------------
More information about the Gcc-bugs
mailing list