public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/48821] New: IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
@ 2011-04-29 13:10 burnus at gcc dot gnu.org
  2011-04-29 15:45 ` [Bug fortran/48821] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-29 13:10 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/48821] IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
  2011-04-29 13:10 [Bug fortran/48821] New: IMPORT :: dummy_arg is rejected, while "IMPORT" imports it burnus at gcc dot gnu.org
@ 2011-04-29 15:45 ` burnus at gcc dot gnu.org
  2011-04-30 16:34 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-29 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-29 15:44:32 UTC ---
The following in decl.c's gfc_match_import looks wrong:

      if (gfc_current_ns->parent !=  NULL
          && gfc_find_symbol (name, gfc_current_ns->parent, 1, &sym))
        {
           gfc_error ("Type name '%s' at %C is ambiguous", name);
           return MATCH_ERROR;
        }
      else if (gfc_current_ns->proc_name->ns->parent !=  NULL
           && gfc_find_symbol (name,
                       gfc_current_ns->proc_name->ns->parent,
                       1, &sym))

I think a "sym == NULL &&" is missing in the else branch.


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

* [Bug fortran/48821] IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
  2011-04-29 13:10 [Bug fortran/48821] New: IMPORT :: dummy_arg is rejected, while "IMPORT" imports it burnus at gcc dot gnu.org
  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
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-30 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-30 16:28:54 UTC ---
The commit went to PR 48800:

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173219
Log:
2011-04-30  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48800
        * decl.c (gfc_match_import): Don't try to find the
        symbol if already found.


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

* [Bug fortran/48821] IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
  2011-04-29 13:10 [Bug fortran/48821] New: IMPORT :: dummy_arg is rejected, while "IMPORT" imports it burnus at gcc dot gnu.org
  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
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-30 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-30 16:33:51 UTC ---
Author: burnus
Date: Sat Apr 30 16:33:47 2011
New Revision: 173221

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173221
Log:
2011-04-30  Tobias Burnus  <burnus@net-b.de>

       PR fortran/48821
       * gfortran.dg/import9.f90: New, proper test.
       * gfortran.dg/interface_37.f90: Remove bogus
       test (bogus copy of interface_36.f90).


Added:
    trunk/gcc/testsuite/gfortran.dg/import9.f90
Removed:
    trunk/gcc/testsuite/gfortran.dg/interface_37.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/48821] IMPORT :: dummy_arg  is rejected, while "IMPORT" imports it
  2011-04-29 13:10 [Bug fortran/48821] New: IMPORT :: dummy_arg is rejected, while "IMPORT" imports it burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-04-30 16:35 ` burnus at gcc dot gnu.org
@ 2011-04-30 16:44 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-30 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-30 16:37:06 UTC ---
FIXED on the 4.7 trunk.


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

end of thread, other threads:[~2011-04-30 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-29 13:10 [Bug fortran/48821] New: IMPORT :: dummy_arg is rejected, while "IMPORT" imports it burnus at gcc dot gnu.org
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

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