From patchwork Thu Dec 10 15:37:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Fanfarillo X-Patchwork-Id: 555192 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 5B316140B8C for ; Fri, 11 Dec 2015 02:37:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=L+hvNNKO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=hf7hwpzuiOT0Z1cRH0XGvGgFbazwdqUxQlTQ19H8XvrtaN DYih6b5ncCD3+xhSiyT2jOYvgL6zHd1uSJKOaomYHfhIdOgUjEXQUitVUvpXXEQ5 TfCVzYs9Tc5Xwg/E+1Od/eJkkhTpIkQb6vBOXK9vr4WhhtxT4bBR177XQF6Kk= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=vK5E1QuwO6+4oPPHElsaSaU9MOI=; b=L+hvNNKOhkT2g///Gwbn YkRhOrPIPDcGWxBmD5S0TFVUbr17DBD70k3tfg6/lDXXA6BlfTBALRj0rxjTRy6Y NKDNIMMxSjiVPdOk4MPIZJ9Jnz56Di6P2I+56qnbMZGUu5nm8sgsbNsD0eHBOHNn nW4dpuett7H78L82vUKzj2I= Received: (qmail 94575 invoked by alias); 10 Dec 2015 15:37:27 -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 94554 invoked by uid 89); 10 Dec 2015 15:37:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-ig0-f181.google.com Received: from mail-ig0-f181.google.com (HELO mail-ig0-f181.google.com) (209.85.213.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 10 Dec 2015 15:37:25 +0000 Received: by igcto18 with SMTP id to18so17870935igc.0; Thu, 10 Dec 2015 07:37:23 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.18.114 with SMTP id v18mr36187189igd.34.1449761843803; Thu, 10 Dec 2015 07:37:23 -0800 (PST) Received: by 10.107.34.75 with HTTP; Thu, 10 Dec 2015 07:37:23 -0800 (PST) Date: Thu, 10 Dec 2015 16:37:23 +0100 Message-ID: Subject: [Fortran, Patch} Fix ICE for coarray Critical inside module procedure From: Alessandro Fanfarillo To: gfortran , gcc-patches , opencoarrays@googlegroups.com X-IsSubscribed: yes Dear all, the compiler returns an ICE when a coarray critical section is used inside a module procedure. The symbols related with the lock variables were left uncommitted inside resolve_critical(). A gfc_commit_symbol after each symbol or a gfc_commit_symbols at the end of resolve_critical() fixed the issue. The latter solution is proposed in the attached patch. Built and regtested on x86_64-pc-linux-gnu Cheers Alessandro PS: This patch should be also included in GCC 5. 2015-12-10 Alessandro Fanfarillo * resolve.c (resolve_critical): Committing symbols of lock variables. 2015-12-10 Alessandro Fanfarillo * gfortran.dg/coarray_critical_1.f90: New. commit ccc06accb4891ab95d33135b62c479d895b2270f Author: Alessandro Fanfarillo Date: Thu Dec 10 15:28:33 2015 +0000 Committing symbols of lock variables inside resolve_critical() diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 65a2b7f..3988b3c 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8852,6 +8852,7 @@ resolve_critical (gfc_code *code) symtree->n.sym->as->cotype = AS_EXPLICIT; symtree->n.sym->as->lower[0] = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1); + gfc_commit_symbols(); } diff --git a/gcc/testsuite/gfortran.dg/coarray_critical_1.f90 b/gcc/testsuite/gfortran.dg/coarray_critical_1.f90 new file mode 100644 index 0000000..4d93bf6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_critical_1.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib" } +! + +module m + contains + subroutine f() + critical + end critical + end subroutine f + end module m +end program