From patchwork Wed Jun 23 21:38:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 56728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 61DD2B6F1A for ; Thu, 24 Jun 2010 07:38:34 +1000 (EST) Received: (qmail 15543 invoked by alias); 23 Jun 2010 21:38:32 -0000 Received: (qmail 15526 invoked by uid 22791); 23 Jun 2010 21:38:30 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 21:38:25 +0000 Received: from [192.168.178.22] (port-92-204-17-153.dynamic.qsc.de [92.204.17.153]) by mx01.qsc.de (Postfix) with ESMTP id 2C6B93DACD; Wed, 23 Jun 2010 23:38:12 +0200 (CEST) Message-ID: <4C227EC4.5000003@net-b.de> Date: Wed, 23 Jun 2010 23:38:12 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.9) Gecko/20100317 SUSE/3.0.4 Thunderbird/3.0.4 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR 44614 Fix diagnostic for IMPORTing CLASS symbols Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 2010-06-23 Tobias Burnus PR fortran/44614 * decl.c (variable_decl): Fix IMPORT diagnostic for CLASS. 2010-06-23 Tobias Burnus 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