public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/47876] New: Host-assoc generic subroutine plus intrinsic function not rejected
Date: Thu, 24 Feb 2011 07:34:00 -0000	[thread overview]
Message-ID: <bug-47876-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: Host-assoc generic subroutine plus intrinsic function
                    not rejected
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/8e0240bbb7628ce2

Steve Lionel claims the code is invalid and NAG also rejects it, which is a
good indication that it is indeed invalid - even though at a glance I thought
the code is valid.

gfortran compiles the following without warning or error:


module hostassoc
  implicit none

  interface pack
     module procedure pack_sub
  end interface

contains

  subroutine pack_sub ()
  end subroutine pack_sub

  subroutine foo (a)
    integer, intent(in) :: a(:)
!   intrinsic :: pack               ! Try uncommenting this line...
    print *, pack (a, a /= 0)
  end subroutine foo

end module hostassoc 


Steve wrote:
  The key to this is paragraph number 5 on p286 of F2008 (12.4.3.4.5
  Restrictions on generic declarations).  It says:

  Within the scope of a generic name that is the same as the generic name
  of an intrinsic procedure, the intrinsic procedure is not accessible by
  its generic name if the procedures in the interface and the intrinsic
  procedure are not all functions or not all subroutines.

  In your case with the INTRINSIC commented out, the PACK intrinsic is
  made inaccessible because your generic PACK has a subroutine as one of
  the interfaces.  Since the intrinsic is inaccessible, the reference to
  PACK as a function fails.

  If you uncomment the INTRINSIC, then you are violating constraint C1215
  (F2008) "Within the scope of a generic name, each pair of procedures
  identified by that name shall both be subroutines or both be functions"


             reply	other threads:[~2011-02-24  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24  7:34 burnus at gcc dot gnu.org [this message]
2015-10-10  9:44 ` [Bug fortran/47876] " dominiq at lps dot ens.fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47876-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).