public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch,Fortran] PR 44614  Fix diagnostic for IMPORTing CLASS symbols
@ 2010-06-23 22:16 Tobias Burnus
  2010-06-23 23:48 ` Steve Kargl
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2010-06-23 22:16 UTC (permalink / raw)
  To: gcc patches, gfortran

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

gfortran did not diagnose the use of non-IMPORTed derived types, if they
were used as CLASS - it only diagnosed TYPE. The patch is on the verge
of being obvious.

Build and currently regtesting on x86-64-linux. If it succeeds:
OK for the trunk?

Tobias

[-- Attachment #2: import-class-fix.diff --]
[-- Type: text/x-patch, Size: 1480 bytes --]

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

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

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

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

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(Revision 161288)
+++ gcc/fortran/decl.c	(Arbeitskopie)
@@ -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)
Index: gcc/testsuite/gfortran.dg/import8.f90
===================================================================
--- gcc/testsuite/gfortran.dg/import8.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/import8.f90	(Revision 0)
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/44614
+!
+!
+
+implicit none
+
+type, abstract :: Connection
+end type Connection
+
+abstract interface
+    subroutine generic_desc(self)
+        ! <<< missing IMPORT 
+        class(Connection) :: self ! { dg-error "has not been declared within the interface" }
+    end subroutine generic_desc
+end interface
+end

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

* Re: [Patch,Fortran] PR 44614  Fix diagnostic for IMPORTing CLASS symbols
  2010-06-23 22:16 [Patch,Fortran] PR 44614 Fix diagnostic for IMPORTing CLASS symbols Tobias Burnus
@ 2010-06-23 23:48 ` Steve Kargl
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Kargl @ 2010-06-23 23:48 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: gcc patches, gfortran

On Wed, Jun 23, 2010 at 11:38:12PM +0200, Tobias Burnus wrote:
> gfortran did not diagnose the use of non-IMPORTed derived types, if they
> were used as CLASS - it only diagnosed TYPE. The patch is on the verge
> of being obvious.
> 
> Build and currently regtesting on x86-64-linux. If it succeeds:
> OK for the trunk?

OK.


-- 
Steve

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

end of thread, other threads:[~2010-06-23 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-23 22:16 [Patch,Fortran] PR 44614 Fix diagnostic for IMPORTing CLASS symbols Tobias Burnus
2010-06-23 23:48 ` Steve Kargl

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