Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Wed, 28 Mar 2007 12:42:48 -0800
Steven G. Kargl wrote:
(snip regarding BOZ constants)
1. BOZ literal constants are INTEGERs and, hence, signed numbers.
2. The largest representable INTEGER in gfortran (on AMD64 GNU/Linux
systems) is a 16 byte integer (irrelevant in this case - it would
be just as wrong were it an 8 byte integer).
(snip)
Is default INTEGER guaranteed to by 32 bits on all Fortran processors?
No, but many uses of BOZ constants are naturally implementation
dependent. There should be a way to correctly specify negative
integer BOZ constants, and also to specify a specific bit pattern
for bitwise intrinsic functions.
I open for suggestions.
Maybe the error message should mention -fno-range-check. At least
then the user would know how to fix the problem.
To get the behaviour you want, you can give gfortran the -fno-range-check
option, and of course you're depending on twos compliment wrap-around
semantics. Your colleague could have read the gfortran.info concerning
the implementation of BOZ in gfortran.
One might use BOZ constants initializing variables for use with
bitwise functions, in which case twos complement is not assumed.
They might also be used to initialize REAL values, necessarily
machine dependent. I believe that should be done with the REAL
intrinsic such as:
DATA R/REAL(Z'C0700000')/
which also fails with gfortran. This will depend on the floating
point format and byte order (see VAX), and so are necessarily machine
dependent.
-- glen
.
- Follow-Ups:
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- References:
- BOZ literal constants, a puzzle for us Standard-loving types.
- From: Toon Moene
- Re: BOZ literal constants, a puzzle for us Standard-loving types.
- From: Steven G. Kargl
- BOZ literal constants, a puzzle for us Standard-loving types.
- Prev by Date: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Next by Date: Re: Why float is called as 'float', not 'real'?
- Previous by thread: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Next by thread: Re: BOZ literal constants, a puzzle for us Standard-loving types.
- Index(es):