------- Comment #6 from burnus at gcc dot gnu dot org  2007-12-06 21:34 -------
> > but the committee seems the have lost track of why programs need specific
> > bit patterns and how they are used.
> 
> See the TRANSFER intrinsic.  I think J3 recognized the problems with
> specify a bit pattern.  J3 also appears to have recognized the limitations
> on TRANSFER because they have allowed BOZ to appear in REAL, INT, DBLE, and
> COMPLX.  Unfortunately, J3 didn't define what this means!

Well, if they had specified what it means, having different hard ware (e.g.
decimal numbers in silicon) would have been more complicated.

> > How about adding something like a "-fhex" enhancement
> > that does this ?
> This is a very nontrivial option to add, and it opens the
> door to (mis)feature creep of a extension.

Well, to allow BOZ in DATA statements (for non-integers) and for
  real r = 'b0'z
it is relatively easy.

> What happens with
>      x = y + Z'deadbeef' + 42
> Is Z'deadbeef' an integer or a real?

With my patch, it is an integer, only in
   variable = boz
boz might be a real/complex bit patter. As soon as you have expressions on the
right-hand side, the boz is regarded as integer.

I find this clear than all the "boz + integer" is "integer+integer" but "boz +
1.0" is "real+real" convention some compilers have.

>    call whoops(Z'deadbeef')  ! Is this an integer or real???

With my patch it is an integer (no assignment and not in a DATA statement).

> I suppose that one can argue that gfortran can restrict BOZ to
> the simplest form of an initialization expression.
> 
>   real, parameter :: x = z'deadbeef'    ! Allowed real bit pattern
>   real, parameter :: y = z'deadbeef'+1. ! Not allowed, BOZ in a RHS expression

This plus BOZ in DATA statements is what my patch (to be submitted in a moment)
does. (Well, it does not reject the second version but regards it as integer
pattern.) The patch also gives some better diagnostic with -std=f95 and
-Wsurprising.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-06 21:34:52
               date|                            |


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

Reply via email to