public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44614]  New: [OOP] Wrongly importing a symbol into an interface without IMPORT
@ 2010-06-21 16:39 burnus at gcc dot gnu dot org
  2010-06-21 16:44 ` [Bug fortran/44614] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-21 16:39 UTC (permalink / raw)
  To: gcc-bugs

Based on a report by bd satish at
http://gcc.gnu.org/ml/fortran/2010-06/msg00210.html

The following program is invalid as IMPORT is missing, but gfortran still
compiles it:

Expected: An error such as:
  Error: line 12: SELF is of undefined derived type CONNECTION
or
  error #6457: This derived type name has not been declared.   [CONNECTION]


module factory_pattern
implicit none

type, abstract :: Connection
    contains
    procedure(generic_desc), deferred :: description
end type Connection

abstract interface
    subroutine generic_desc(self)
!        import
        class(Connection) :: self
    end subroutine generic_desc
end interface
end module factory_pattern


-- 
           Summary: [OOP] Wrongly importing a symbol into an interface
                    without IMPORT
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/44614] [OOP] Wrongly importing a symbol into an interface without IMPORT
  2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
@ 2010-06-21 16:44 ` burnus at gcc dot gnu dot org
  2010-06-21 18:01 ` janus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-21 16:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-06-21 16:44 -------
Cf. also PR 44616 for the ICE reported at the mailing list.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu dot org


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


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

* [Bug fortran/44614] [OOP] Wrongly importing a symbol into an interface without IMPORT
  2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
  2010-06-21 16:44 ` [Bug fortran/44614] " burnus at gcc dot gnu dot org
@ 2010-06-21 18:01 ` janus at gcc dot gnu dot org
  2010-06-22 21:01 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-21 18:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janus at gcc dot gnu dot org  2010-06-21 18:00 -------
Confirmed. Changing the CLASS statement into TYPE gives the correct error:

        type(Connection) :: self
                                1
Error: the type of 'self' at (1) has not been declared within the interface


-- 

janus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-06-21 18:00:04
               date|                            |


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


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

* [Bug fortran/44614] [OOP] Wrongly importing a symbol into an interface without IMPORT
  2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
  2010-06-21 16:44 ` [Bug fortran/44614] " burnus at gcc dot gnu dot org
  2010-06-21 18:01 ` janus at gcc dot gnu dot org
@ 2010-06-22 21:01 ` burnus at gcc dot gnu dot org
  2010-06-24  7:51 ` burnus at gcc dot gnu dot org
  2010-06-24  8:01 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-22 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2010-06-22 21:01 -------
Simple patch. Janus, if you have time, you can create a full patch out of it.

Index: decl.c
===================================================================
--- decl.c      (revision 161227)
+++ decl.c      (working copy)
@@ -1764,7 +1764,7 @@ variable_decl (int elem)
      specified in the procedure definition, except that the interface
      may specify a procedure that is not pure if the procedure is
      defined to be pure(12.3.2).  */
-  if (current_ts.type == BT_DERIVED
+  if ((current_ts.type == BT_DERIVED || current_ts.type == BT_CLASS)
       && gfc_current_ns->proc_name
       && gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY
       && current_ts.u.derived->ns != gfc_current_ns)


-- 


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


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

* [Bug fortran/44614] [OOP] Wrongly importing a symbol into an interface without IMPORT
  2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-06-22 21:01 ` burnus at gcc dot gnu dot org
@ 2010-06-24  7:51 ` burnus at gcc dot gnu dot org
  2010-06-24  8:01 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-24  7:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2010-06-24 07:51 -------
Subject: Bug 44614

Author: burnus
Date: Thu Jun 24 07:51:22 2010
New Revision: 161310

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161310
Log:
2010-06-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44614
        * decl.c (variable_decl): Fix IMPORT diagnostic for CLASS.

2010-06-24  Tobias Burnus  <burnus@net-b.de>

        PR fortran/44614
        * gfortran.dg/import8.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/import8.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/44614] [OOP] Wrongly importing a symbol into an interface without IMPORT
  2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-06-24  7:51 ` burnus at gcc dot gnu dot org
@ 2010-06-24  8:01 ` burnus at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-24  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2010-06-24 08:01 -------
FIXED on the trunk (4.6).


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-06-24  8:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 16:39 [Bug fortran/44614] New: [OOP] Wrongly importing a symbol into an interface without IMPORT burnus at gcc dot gnu dot org
2010-06-21 16:44 ` [Bug fortran/44614] " burnus at gcc dot gnu dot org
2010-06-21 18:01 ` janus at gcc dot gnu dot org
2010-06-22 21:01 ` burnus at gcc dot gnu dot org
2010-06-24  7:51 ` burnus at gcc dot gnu dot org
2010-06-24  8:01 ` burnus at gcc dot gnu dot 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).