From patchwork Tue Jun 20 12:01:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1797271 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QllcN6PNsz20WT for ; Tue, 20 Jun 2023 22:02:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87565385843E for ; Tue, 20 Jun 2023 12:02:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 454503858D1E; Tue, 20 Jun 2023 12:01:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 454503858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.00,257,1681200000"; d="diff'?scan'208";a="9325982" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 20 Jun 2023 04:01:53 -0800 IronPort-SDR: 7lahKvOtSTuyGluM45wODB4fN2R88ofiJShgj97YMkSeON6LGIRcQ4lU9j0Z7jrdaqB8VAi3k4 jL3jtJONIFXO/BUKWfJ3DAlsnr/WFRqbZ7F9FA7hr8Y9WqavMb16QF4FgB8zBquS36h0DQN7FH UN7MSxmJdmp2MnPWlzSvGEnvy5fMGfYfNvbyONHjiTKvCmS12Ixb8GDTJjArnIKUMxYsrA1PZN xLQPpKbtMXQYHntyyHIZKE524TJzlYhXlEjl1+7Z9cQozCzNmDMT8gvwnfVNSCnTVeJicbzIge ijo= Message-ID: Date: Tue, 20 Jun 2023 14:01:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: gcc-patches , fortran From: Tobias Burnus Subject: [committed] Fortran: Fix parse-dump-tree for OpenMP ALLOCATE clause X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" A rather obvious fix. The allocator(...) bit showed up with -fdump-parse-tree. Committed as Rev. r14-1988-g99e3214f582b08 Side remark: Regarding the example inside the commit log: OpenMP 5.1 permitted derived-type components. Due to global wording changes, OpenMP 5.2 disabled it for both the new 'allocators' and for the old 'allocate' directive. This turned out to be an accidental change and it will be permitted in a future OpenMP version again (for 'allocators' as the executable form of the 'allocate' directive was deprecated and then removed; in GCC, we will have to support it for both for legacy support reasons). – While n->expr is now support for the dump, it is currently unreachable as dt-component parsing is disabled for both allocate and allocators. (To be changed.) Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 commit 99e3214f582b08b69b11b53eb3fc73b0919ef4f1 Author: Tobias Burnus Date: Tue Jun 20 13:46:11 2023 +0200 Fortran: Fix parse-dump-tree for OpenMP ALLOCATE clause Commit r14-1301-gd64e8e1224708e added u2.allocator to gfc_omp_namelist for better readability and to permit to use namelist->expr for code like the following: !$omp allocators allocate(align(32) : dt%alloc_comp) allocate (dt%alloc_comp(5)) !$omp allocate(dt%alloc_comp2) align(64) allocate (dt%alloc_comp2(10)) However, for the parse-tree dump the change was incomplete. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_namelist): Fix dump of the allocator modifier of OMP_LIST_ALLOCATE. diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc index 99c8bdaadce..effcebe9325 100644 --- a/gcc/fortran/dump-parse-tree.cc +++ b/gcc/fortran/dump-parse-tree.cc @@ -1370,31 +1370,34 @@ show_omp_namelist (int list_type, gfc_omp_namelist *n) fputc (list_type == OMP_LIST_AFFINITY ? ':' : ',', dumpfile); } } ns_iter = n->u2.ns; } if (list_type == OMP_LIST_ALLOCATE) { - if (n->expr) + if (n->u2.allocator) { fputs ("allocator(", dumpfile); show_expr (n->u2.allocator); fputc (')', dumpfile); } if (n->expr && n->u.align) fputc (',', dumpfile); if (n->u.align) { fputs ("align(", dumpfile); show_expr (n->u.align); fputc (')', dumpfile); } - if (n->expr || n->u.align) + if (n->u2.allocator || n->u.align) fputc (':', dumpfile); - fputs (n->sym->name, dumpfile); + if (n->expr) + show_expr (n->expr); + else + fputs (n->sym->name, dumpfile); if (n->next) fputs (") ALLOCATE(", dumpfile); continue; } if (list_type == OMP_LIST_REDUCTION) switch (n->u.reduction_op) {