This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: ibits
On Tue, Jan 02, 2007 at 01:53:49PM -0500, Dean McCullough wrote:
> Thanks for your suggestions, but ....
>
> I have installed gfortran-4.3.0. It was also pointed out that I had
> transposed the arguments to ibits. I believe ibits(j,0,32) should
> extract 32 bits from j, starting with bit 0.
>
> Unfortunately, even with the new version of gfortran, I am getting:
> 57 3FFFFFFFFFFFFFF 3FFFFFFFFFFFFFF
> 58 7FFFFFFFFFFFFFF 7FFFFFFFFFFFFFF
> 59 FFFFFFFFFFFFFFF FFFFFFFFFFFFFFF
> 60 1FFFFFFFFFFFFFFF 1FFFFFFFFFFFFFFF
> i.e. NOT 32 bits.
I ran your original program with ifort 8.1 and gfortran, and
the results agree:
$ gfortran -fdefault-integer-8 ibits.f && ./a.out | tail -10
61 3FFFFFFFFFFFFFFF 0
62 7FFFFFFFFFFFFFFF 0
63 FFFFFFFFFFFFFFFF 0
64 FFFFFFFFFFFFFFFF 0
65 FFFFFFFFFFFFFFFF 0
66 FFFFFFFFFFFFFFFF 0
67 FFFFFFFFFFFFFFFF 0
68 FFFFFFFFFFFFFFFF 0
69 FFFFFFFFFFFFFFFF 0
70 FFFFFFFFFFFFFFFF 0
$ ifort -i8 ibits.f && ./a.out | tail -10
61 3FFFFFFFFFFFFFFF 0
62 7FFFFFFFFFFFFFFF 0
63 FFFFFFFFFFFFFFFF 0
64 FFFFFFFFFFFFFFFF 0
65 FFFFFFFFFFFFFFFF 0
66 FFFFFFFFFFFFFFFF 0
67 FFFFFFFFFFFFFFFF 0
68 FFFFFFFFFFFFFFFF 0
69 FFFFFFFFFFFFFFFF 0
70 FFFFFFFFFFFFFFFF 0
So, if gfortran is wrong, it is at least in good company.
I suggest posting this as a question on comp.lang.fortran.
Thomas