From patchwork Fri Aug 15 16:33:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 380327 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 B0FFE140080 for ; Sat, 16 Aug 2014 02:33:44 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=PjN6ueioJ8n+Gxmhe6PJzUEYGSd66bq1LdDBxwZ5SI+hbQ UG4BSy5K4+KJNBvrdOZW8izMbl+0CzYzMlwiybIehfydIzAzbeIasrulp6b/BuFy 8Er5meP+UG8Nfgg+qKQyL3MnOT9AvkPZ+v2iApUnNjsljwpMJpBazHIgz5uRY= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=ZUwxx7H18T8r90cR8iLrzUKffFU=; b=Imw4AFa7JvUajfVyBHJJ HGKvGP/zMGOBFgB+z3tkSo54OOBMXUbR1U3akgyuazmAoJngXYsMwChypC1W54Vq SdmGB4168fhXlQU+GFANeYDcBpSQAH/Z8XlXvyW3HoaYZeQaojujW1pEK2J6vne1 oQ7sdfbObGocUpSPRu+BeQ4= Received: (qmail 13256 invoked by alias); 15 Aug 2014 16:33:36 -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 13239 invoked by uid 89); 15 Aug 2014 16:33:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx02.qsc.de Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 15 Aug 2014 16:33:33 +0000 Received: from tux.net-b.de (port-92-194-19-7.dynamic.qsc.de [92.194.19.7]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx02.qsc.de (Postfix) with ESMTPSA id 89EEE24B48; Fri, 15 Aug 2014 18:33:28 +0200 (CEST) Message-ID: <53EE3658.1040903@net-b.de> Date: Fri, 15 Aug 2014 18:33:28 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: gcc-patches , gfortran Subject: [Patch, Fortran] Fix CRITICAL handling with -fcoarray=lib It turned out that the CRITICAL patch had two issues: a) The lock variable was named "__lock_var@0". That's unambiguous but the linker didn't like the file name. As the variable is unused (only the associated token gets used), the assembler error only occurred with -O0 and hence not in the test suite. That's now fixed by using valid mangled name; I did the same for the type, which shouldn't show up in the assembly except for the DWARF type output. But for completeness, I have also mangled it properly. b) I somehow mixed up the arguments of LOCK; the lock_acquired argument is a pointer to a Boolean variable, telling whether the lock could be obtained. For CRITICAL, we want to pass NULL, which means that LOCK waits until the lock can be obtained. That issue was caught by coarray/sync_{1,3}.f90, but somehow, I had missed it. Committed as obvious in Rev. 214029. Tobias Index: ChangeLog =================================================================== --- ChangeLog (revision 214027) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-08-15 Tobias Burnus + + * resolve.c (resolve_critical): Fix name mangling. + * trans-stmt.c (gfc_trans_critical): Fix lock call. + 2014-08-15 Manuel López-Ibáñez PR fortran/44054 Index: resolve.c =================================================================== --- resolve.c (revision 214027) +++ resolve.c (working copy) @@ -8485,13 +8485,14 @@ resolve_critical (gfc_code *code) if (gfc_option.coarray != GFC_FCOARRAY_LIB) return; - symtree = gfc_find_symtree (gfc_current_ns->sym_root, "__lock_type@0"); + symtree = gfc_find_symtree (gfc_current_ns->sym_root, + GFC_PREFIX ("lock_type")); if (symtree) lock_type = symtree->n.sym; else { - if (gfc_get_sym_tree ("__lock_type@0", gfc_current_ns, &symtree, - false) != 0) + if (gfc_get_sym_tree (GFC_PREFIX ("lock_type"), gfc_current_ns, &symtree, + false) != 0) gcc_unreachable (); lock_type = symtree->n.sym; lock_type->attr.flavor = FL_DERIVED; @@ -8500,7 +8501,7 @@ resolve_critical (gfc_code *code) lock_type->intmod_sym_id = ISOFORTRAN_LOCK_TYPE; } - sprintf(name, "__lock_var@%d",serial++); + sprintf(name, GFC_PREFIX ("lock_var") "%d",serial++); if (gfc_get_sym_tree (name, gfc_current_ns, &symtree, false) != 0) gcc_unreachable (); Index: trans-stmt.c =================================================================== --- trans-stmt.c (revision 214027) +++ trans-stmt.c (working copy) @@ -1121,7 +1121,7 @@ gfc_trans_critical (gfc_code *code) token = GFC_TYPE_ARRAY_CAF_TOKEN (TREE_TYPE (token)); tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_lock, 7, token, integer_zero_node, integer_one_node, - boolean_true_node, null_pointer_node, + null_pointer_node, null_pointer_node, null_pointer_node, integer_zero_node); gfc_add_expr_to_block (&block, tmp); }