This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: BOZ question


On Tue, Aug 31, 2010 at 04:37:13PM +0200, FX wrote:
> > 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.
> 
> Thanks Steve for pointing this out. So, from what I gathered from the standards:
> 
>   -- F95 only allows BOZ in data statements

yes.

>   -- F2003 also allows it as argument to DBLE, REAL, INT and CMPLX

yes.

>   -- F2008 also allows it in BGE, BGT, BLE, BLT, DSHIFTL, DSHIFTR, IAND,
>      IEOR, IOR and MERGE_BITS.

I haven't looked at F2008 in any detail.  So, I'll accept the above as
items you've distilled from F2008.

> The gfortran documentation (http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html) gives a list of places where BOZ can be used, but it's not clear whether the list is exhaustive or not. Can it be used anywhere an integer litteral can be used?

I could be wrong, but I believe the answer is 'yes'.  At least, the
simple test program shows that boz is accepted in a expresion.

troutmask:sgk[203] cat > fg.f90
integer i
i = z'ff' + o'33' + b'101010'
print *, i
end
troutmask:sgk[205] gfc4x -o z fg.f90
troutmask:sgk[206] ./z
         324

> 
> >From there, I have two questions:
> 
>   -- shouldn't the default compiler flags follow the F2003 standard,
>      rather than the old extension? If so, would it be acceptable to
>      move the behaviour to -std=legacy?

Unfortunately, I think this goes back to g77.  When -std=gnu was made
the default, there was a desire to maintain backwards compatibility 
with g77.  At this point in time, it may be too late to change the
behavior to -std=legacy.  I fear the if we changed the default behavior
that we would a large amount of user push-back.

>   -- if -std=f2003 is specified, shouldn't the compiler reject
>      code such as: ishft(z"ae0f", 3) 

May be.  I would need to audit gfortran against f2003 (and now f2008)
to determine what the correct behavior should be.

> As I see that the current state of BOZ vs. F2003 is not well
> settled, I'll start to implement the new intrinsics without
> dealing with BOZ.

Seems like a good plan to me.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]