public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54072] New: BOZ with -std=f2008: wrongly accepted to TRANSFER/ABS/...; two BOZ not rejected for IOR/IEOR/IAND
@ 2012-07-23 12:44 burnus at gcc dot gnu.org
  2012-07-23 12:46 ` [Bug fortran/54072] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-07-23 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54072
           Summary: BOZ with -std=f2008: wrongly accepted to
                    TRANSFER/ABS/...; two BOZ not rejected for
                    IOR/IEOR/IAND
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Motivated by the question at
http://www.rhinocerus.net/forum/lang-fortran/710304-why-does-boz-literal-work-ok-transfer-call-but-not-declarationwith-gfortran.html

Note that for INT(<overflowing BOZ>) the standard has: "If A is a
boz-literal-constant, the value of the result is the value whose bit sequence
according to the model in 13.3 is the same as that of A as modified by padding
or truncation according to 13.3.3. The interpretation of a bit sequence whose
most significant bit is 1 is processor dependent." - Thus, printing an error
should be fine.

 * * *

Fortran 2008 only allows BOZ at:

"C4102 (R463) A boz-literal-constant shall appear only as a data-stmt-constant
in a DATA statement, or where explicitly allowed in subclause 13.7 as an actual
argument of an intrinsic procedure."

If one looks for "BOZ" for TRANSFER, one finds nothing:

   SOURCE shall be a scalar or array of any type.

Thus, I think one has to conclude that it is not allowed. - But gfortran
silently accepts it.  Similarly for, e.g., ABS.

 * * *

The following is accepted
  print *, ior(z'111',z'010')

However, the standard requires:
  I and J shall not both be boz-literal-constants.
Similarly for iand and ieor. However, two BOZ to dshiftr are properly rejected.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-03 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-23 12:44 [Bug fortran/54072] New: BOZ with -std=f2008: wrongly accepted to TRANSFER/ABS/...; two BOZ not rejected for IOR/IEOR/IAND burnus at gcc dot gnu.org
2012-07-23 12:46 ` [Bug fortran/54072] " burnus at gcc dot gnu.org
2012-07-23 13:17 ` burnus at gcc dot gnu.org
2012-07-23 13:45 ` burnus at gcc dot gnu.org
2013-09-03 15:17 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).