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/48821] New: IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
Date: Fri, 29 Apr 2011 13:10:00 -0000	[thread overview]
Message-ID: <bug-48821-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: IMPORT :: dummy_arg  is rejected, while "IMPORT"
                    imports it
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


>From the tread at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/468cd06becef7494

The following program compiles with Open64 and PathScale 3.2.99, but it fails
with ifort 11.1 ("error #6485: Dummy args may not be used as IMPORT_name
entities   [Y]") and with gfortran:

                 import :: Y
                            1
Error: Cannot IMPORT 'y' from host scoping unit at (1) - does not exist.

A simple "IMPORT" works.

>From F2008's "12.4.3.3 IMPORT statement": "The name of an entity made
accessible by an IMPORT statement shall not appear in any of the contexts
described in 16.5.1.4 that cause the host entity of that name to be
inaccessible."

I have not yet fully understood 16.5.1.4, but I am rather sure that the code is
valid -- however, one should check ...


Program by Daniel Carrera:

module types
  integer, parameter :: pref = kind(0.0)
end module

use types
contains
     pure subroutine rk4_vec(t, Y, dY, h)
         real(pref), intent(inout) :: t, Y(:)
         real(pref), intent(in) :: h
         real(pref), dimension(size(Y)) :: k1, k2, k3, k4

         interface
             pure function dY(t0, y0)
                 use types
                 import :: Y
                 real(pref), intent(in) :: t0, y0(size(Y))
                 real(pref) :: dY(size(y0))
             end function
         end interface

         k1 = dY(t, Y)
         k2 = dY(t + h/2, Y + k1*h/2)
         k3 = dY(t + h/2, Y + k2*h/2)
         k4 = dY(t + h  , Y + k3*h)

         Y = Y + (k1 + 2*k2 + 2*k3 + k4) * h/6
         t = t + h
     end subroutine
end


             reply	other threads:[~2011-04-29 13:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 13:10 burnus at gcc dot gnu.org [this message]
2011-04-29 15:45 ` [Bug fortran/48821] " burnus at gcc dot gnu.org
2011-04-30 16:34 ` burnus at gcc dot gnu.org
2011-04-30 16:35 ` burnus at gcc dot gnu.org
2011-04-30 16:44 ` burnus at gcc dot gnu.org

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