BOZ question

Steve Kargl sgk@troutmask.apl.washington.edu
Tue Aug 31 14:12:00 GMT 2010


On Tue, Aug 31, 2010 at 03:32:27PM +0200, FX wrote:
> Dear gfortran developpers,
> 
> I have a BOZ-related question. I am trying to understand how BOZ are handled in the current front-end, in order to implement the remaining missing bit intrinsics from F2008. I have to say I don't have a bird's eye view yet of how the front-end handles BOZes, so here is my question:
> 
> What is the following code supposed to output:
> 
>   integer(kind=8) :: i
>   i = 0
>   print *, kind(ior (i, z"ff1e"))
>   print *, kind(ior (0_8, z"ff1e"))
>   end
> 
> 
> The ways the standard describes IOR (I, J) says:
> 
> * I or J can be BOZ or integers, but they can't both be BOZ.
> * "Result Characteristics. Same as I if I is of type integer; otherwise, same as J."
> 
> According to my reading, the expected kind in my example is 8. The compiler currently doesn't make its mind, as it says "8" for the compile-time simplified result, and "16" for the second print statement.
> 
> Have I missed something?
> 

Try adding -std=f95 and then -std=f2003 to your
command line.  This appears to be an inconsistency
between a GNU extension and what the F2008 standard
requires, and there appears to a bug in on of the 
code paths routine (expected output is 16 for both
after promotion to the largest kind).  I suspect that
this issue appears in all bit manipulation intrinsics
with respect to F2008.

-- 
Steve



More information about the Fortran mailing list