------- Comment #13 from jkrahn at nc dot rr dot com  2007-12-11 19:40 -------
My previous post here was a bit confused by differences in F95 and F2003, and
my misunderstanding of Gfortran's BOZ extension.

As I understand the F2003 standard, the expression "INT(z'ff',1)" should
produce a range error, for the same reasons as the data statement illustrated
in:
http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html
In practice, I don't think any compilers do this (yet).

I thought that F2003 allowed this type of BOZ usage because the KIND was well
defined, because the F2003 (draft) standard gives the rule for interpretation
as the largest integer kind with DATA statements, but not under REAL(), DBLE(),
or CMPLX(). However, I just checked again and found that INT() does require the
initial interpretation as the largest integer kind. Unless the final standard
differs, it appears that interpretation of BOZ for REAL(), etc., are completely
undefined. As far as I can tell, it would be equally valid to interpret a hex
value as a binary real value, or just to convert as with integer assignment.

Due to being ill-defined, I suggested ignoring the standard. Instead, the right
suggestion is an extension which modifies the standard. Maybe there should be a
"-f[no-]boz-range-check" to exclude range errors just for the BOZ case. Also,
to avoid misleading users into thinking that F2003 BOZ are well-defined, it
might be good to warn about any BOZ usage, maybe as part of "-Wsurprising".

F2008 draft, it re-defines B/O/Z literals, named BITS instead of BOZ. It seems
to be an improvement, but will probably add to the difficulty of supporting
multiple standards. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29471

Reply via email to