From patchwork Fri Jul 18 10:02:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 371435 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A882A1400B6 for ; Fri, 18 Jul 2014 20:02:29 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=UxCiHHc1V4NNt5khcDveG6UGmN9NV2G/S1Nh7fa/i8gkVLzr97+jT RYaTt17QOlzHQ+gWTOrcq84Ihet0Q87nK+lD4hA8vQAikv+9qWfSC2MHm2XDWIgt GUQC7b/0zpWJaWQxzgiZpE+tufkaqvHi/XCPt13+hXfoYjWa+JssNw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=MtSt0JeLMGxGrEuGjTF+kEyixoQ=; b=cGP+DVl23MEpeOK1/N9i EV4KcHs5AYpTUe89VYOaSuj50RmaPDourau48RZrRZ5/tK6V8eVLDKtKqcMmYo9v LMYYxDxhA57PKQY96mWQfOrMB1rel3+gxn8QXTI1yLixQDPuxvMhXTnjO2X68YmP 8hl23mgz8GIQqCuqqtuwTHM= Received: (qmail 18726 invoked by alias); 18 Jul 2014 10:02:22 -0000 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 Received: (qmail 18707 invoked by uid 89); 18 Jul 2014 10:02:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mout.gmx.net Received: from mout.gmx.net (HELO mout.gmx.net) (212.227.17.22) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 18 Jul 2014 10:02:15 +0000 Received: from vepi2.private ([84.63.33.109]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MDFB2-1XK8kA1hEq-00GXfv; Fri, 18 Jul 2014 12:02:10 +0200 Date: Fri, 18 Jul 2014 12:02:09 +0200 From: Andre Vehreschild To: gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: PR 60414: Patch proposal Message-ID: <20140718120209.4adf6cb7@vepi2.private> MIME-Version: 1.0 Hi all, this is my first try to submit a patch, so please be kind and correct me when I do something wrong. I was contracted to fix some issues listed in the bugtracker for fortran. Please find attached my first attempt for bug PR60414 (I'll attach it to the bug in the tracker in a second). The bug terminates the compiler, because in the translation phase an unexpected construction is seen as actual argument. I tracked down the location where the decision to construct the parse tree seen is made and deduced, that the parameter matching is not respecting the array_ref done in the code not compiling. I have fixed this by checking if the ->ref member of the actual argument is set. The analysis continues and the test case created for it compile fine now. Patch content: - Changelog entry in gcc/fortran/Changelog - Changelog entry in gcc/testsuite/Changelog - Patch in interface.c: two line comment, one line actual code - Testcase in gcc/testsuite/fortran.dg/unlimited_polymorphism_18.f90 Regards, Andre diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c33936b..cb01a13 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2014-07-19 Andre Vehreschild + + PR fortran/60414 + * interface.c (compare_parameter): Fix compile bug: During resolution + of generic an array reference in the actual argument was not + respected. Fixed by checking, if the ref member is non-null. Testcase + unlimited_polymorphism_18.f90 add. + 2014-06-15 Tobias Burnus * symbol.c (check_conflict): Add codimension conflict with diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index b210d18..8658003 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2156,7 +2156,10 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1) return 1; + /* Only check ranks compatibility, if actual is not an array reference, + i.e., actual(i) indicated by actual->ref being set. */ if (actual->ts.type == BT_CLASS && CLASS_DATA (actual)->as + && !actual->ref && CLASS_DATA (actual)->as->rank == symbol_rank (formal)) return 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6e9f23..84e16da 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-19 Andre Vehreschild + + * gfortran.dg/unlimited_polymorphism_18.f90: Check according to + PR 60414 + 2014-07-17 Richard Sandiford * gcc.target/mips/umips-lwp-1.c (foo): Use a shift/add sequence