From patchwork Wed Dec 3 17:08:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Vehreschild X-Patchwork-Id: 417507 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 C1F101400D5 for ; Thu, 4 Dec 2014 04:08:46 +1100 (AEDT) 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:cc:subject:message-id:in-reply-to:references :mime-version:content-type; q=dns; s=default; b=PlrGxlex3GQwPc8N WvXQv2HgnmEMiSGZ6qCSbZ7+4SMEPDCowquV4G3wcLpRQBc1HB5FS+sKhcuxQRn2 T7zHyBpqXUvMrE/c1s1Q8bTPlTAX/yqMf3wC4+ZUJp9LpVo49J2mt5Oy+XGCPCmX Rrd7mt+jzErs8Kc0yU5HGhtt/TM= 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:cc:subject:message-id:in-reply-to:references :mime-version:content-type; s=default; bh=ZsYlbvBJ3qrBvhmFYP6u30 LkIio=; b=uTnNb7n4I/eDyuQfgbDVoWd6onhf0xLQLy1SYonJ7fTtPEtd/KvfBR b+1devc263Ok0YBKrAuLIagtTcVn6AmKA/LhjiOZ/StoEHi85Vr4woB9/1pXZHps DMlHPXDHwJlr17oZ/Eh17zFV0Nl5G5tEPXwUJ2UcIlo5IrgEW2h/E= Received: (qmail 12649 invoked by alias); 3 Dec 2014 17:08:39 -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 12630 invoked by uid 89); 3 Dec 2014 17:08:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 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.15.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 03 Dec 2014 17:08:36 +0000 Received: from localhost ([84.63.49.248]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0M5dMm-1Y7JDP3sfg-00xXGR; Wed, 03 Dec 2014 18:08:28 +0100 Date: Wed, 3 Dec 2014 18:08:24 +0100 From: Andre Vehreschild To: Mikael Morin Cc: Dominique Dhumieres , fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org, "Antony Lewis" Subject: Re: [PATCH, Fortran] PR fortran/60414 fix ICE was: PR 60414: Patch proposal Message-ID: <20141203180824.3f15a063@gmx.de> In-Reply-To: <20140826113012.77851d12@vepi2.private> References: <20140721072605.0D680105@mailhost.lps.ens.fr> <20140721150350.10b35dd3@vepi2.private> <911AF20A-F5E2-474F-858A-BF5CE56235D5@lps.ens.fr> <53D3FF8A.106@sfr.fr> <20140806212302.4bf07e11@vepi2.private> <53F09518.8040601@sfr.fr> <20140817122628.2773C105@mailhost.lps.ens.fr> <53F0A8BA.2000303@sfr.fr> <20140826113012.77851d12@vepi2.private> MIME-Version: 1.0 X-UI-Out-Filterresults: notjunk:1; Hi, this patch is ready for commit now. Please apply. There have been no objections against doing dg-do compile only, since my last post in August. - Andre On Tue, 26 Aug 2014 11:30:12 +0200 Andre Vehreschild wrote: > Hi, > > On Sun, 17 Aug 2014 15:06:02 +0200 > Mikael Morin wrote: > > > Le 17/08/2014 14:26, Dominique Dhumieres a écrit : > > > As Mikael said in https://gcc.gnu.org/ml/fortran/2014-08/msg00047.html > > > > > >> the testcase should check that the code generated is actually working, > > >> not just that the ICE disappeared. ... > > > > > Well, this is for another patch where deferred character variable are > > made acceptable as argument to unlimited polymorphic dummies. > > Here the ICE comes (if I remember correctly) from the wrong generic > > procedure being picked, so there is not really some new feature enabled > > with the patch. > > This is correct so far. > > > > > > thus I think the test should be run, i.e., '! { dg-do compile }' should > > > be replaced with '! { dg-do run }' (I have checked that the test > > > succeeds). > > > > > I don't have a strong opinion for it, but I'm OK with that change. > > In fact the initial test was a run one, and it has been changed to > > compile. Andre: why? > > I was asked to move to compile only, because a run test takes a lot of time. > I was told that the run test compiles the code multiple times with different > optimization. This issue was deemed to be solely on the compile stage and was > not influenced by optimization. Therefore I agreed to switch to dg-do compile. > That the test is fine for running, too, is merely for my training of how to do > that. My opinion is, that dg-do compile is sufficient to prove, that PR60414 > is resolved, because that is the sole purpose of the patch. I understand > Dominique wanting to have the dg-do run, because the effectiveness of the > patch is only shown on running the test. Is there a compromise of running a > test, but only for one optimization stage? Then may be we can do that. > > - Andre diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 2429fd2..c8f61e1 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2156,10 +2156,6 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, if (symbol_rank (formal) == actual->rank || symbol_rank (formal) == -1) return 1; - if (actual->ts.type == BT_CLASS && CLASS_DATA (actual)->as - && CLASS_DATA (actual)->as->rank == symbol_rank (formal)) - return 1; - rank_check = where != NULL && !is_elemental && formal->as && (formal->as->type == AS_ASSUMED_SHAPE || formal->as->type == AS_DEFERRED) diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_18.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_18.f90 new file mode 100644 index 0000000..7a0df1a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_18.f90 @@ -0,0 +1,69 @@ +! { dg-do compile } +! Testing fix for +! PR fortran/60414 +! +module m + implicit none + Type T + real, public :: expectedScalar; + contains + procedure :: FCheck + procedure :: FCheckArr + generic :: Check => FCheck, FCheckArr + end Type + +contains + + subroutine FCheck(this,X) + class(T) this + class(*) X + real :: r + select type (X) + type is (real) + if ( abs (X - this%expectedScalar) > 0.0001 ) then + call abort() + end if + class default + call abort () + end select + end subroutine FCheck + + subroutine FCheckArr(this,X) + class(T) this + class(*) X(:) + integer i + do i = 1,6 + this%expectedScalar = i - 1.0 + call this%FCheck(X(i)) + end do + end subroutine FCheckArr + + subroutine CheckTextVector(vec, n, scal) + integer, intent(in) :: n + class(*), intent(in) :: vec(n) + class(*), intent(in) :: scal + integer j + Type(T) :: Tester + + ! Check full vector + call Tester%Check(vec) + ! Check a scalar of the same class like the vector + Tester%expectedScalar = 5.0 + call Tester%Check(scal) + ! Check an element of the vector, which is a scalar + j=3 + Tester%expectedScalar = 2.0 + call Tester%Check(vec(j)) + + end subroutine CheckTextVector + +end module + +program test + use :: m + implicit none + + real :: vec(1:6) = (/ 0, 1, 2, 3, 4, 5 /) + call checktextvector(vec, 6, 5.0) +end program test +