public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50753] New: dshiftl/dshiftr: Rejects valid BOZ, accepts double BOZ
@ 2011-10-17  6:52 burnus at gcc dot gnu.org
  2011-10-27 15:50 ` [Bug fortran/50753] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-10-17  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50753
           Summary: dshiftl/dshiftr: Rejects valid BOZ, accepts double BOZ
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: kargl@gcc.gnu.org


Found when checking PR fortran/50514:

gfortran rejects:

  integer :: I, J
  print *, dshiftl(z'FFF', J, (bit_size(j)+1))
  end

with
   Error: 'j' argument of 'dshiftl' intrinsic at (1) must
          be the same type and kind as 'i'

Expected:
a) The BOZ is accepted
b) There is a diagnostic as SHIFT is larger than BIT_SIZE(J).


The same applies to DSHIFTR.


>From Fortran 2008's 13.7.50 DSHIFTL (I, J, SHIFT)

"Arguments.

 I   shall be of type integer or a boz-literal-constant.
 J   shall be of type integer or a boz-literal-constant. If both I and J are
     of type integer, they shall have the same kind type parameter. I and J
     shall not both be boz-literal-constants.
 SHIFT  shall be of type integer. It shall be nonnegative and less than
     or equal to BIT SIZE (I) if I is of type integer; otherwise, it shall
     be less than or equal to BIT SIZE (J)."

 Result Value.   If either I or J is a boz-literal-constant, it is first
 converted as if by the intrinsic function INT to type integer with the kind
 type parameter of the other."

 * * *

Additionally, the following is accepted but invalid: Only one BOZ is allowed:

  print *, dshiftl(z'FFF', z'AAA', 0)
  end

I am not sure whether it should be allowed with -std=gnu, but none of my
compilers diagnoses it correctly. (Well, except for ifort, which even rejects
the example of the Fortran 2008 standard.)


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

end of thread, other threads:[~2011-10-30 22:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-17  6:52 [Bug fortran/50753] New: dshiftl/dshiftr: Rejects valid BOZ, accepts double BOZ burnus at gcc dot gnu.org
2011-10-27 15:50 ` [Bug fortran/50753] " kargl at gcc dot gnu.org
2011-10-27 15:57 ` sgk at troutmask dot apl.washington.edu
2011-10-29 15:18 ` burnus at gcc dot gnu.org
2011-10-30 22:03 ` kargl at gcc dot gnu.org
2011-10-30 22:10 ` kargl at gcc dot gnu.org

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).