This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/47876] New: Host-assoc generic subroutine plus intrinsic function not rejected


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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]