From patchwork Tue Sep 13 11:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul-Antoine Arras X-Patchwork-Id: 1182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp2293401wrt; Tue, 13 Sep 2022 04:04:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LpfiTNcjP9cwNJdpjyih0Cq0YsH/vzEkWjGRdm7jdHgGoYz7bIq8zN4tNv1jdLmD6hOKk X-Received: by 2002:a05:6402:1f02:b0:445:f674:eac0 with SMTP id b2-20020a0564021f0200b00445f674eac0mr24739676edb.370.1663067053269; Tue, 13 Sep 2022 04:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663067053; cv=none; d=google.com; s=arc-20160816; b=P7JzuWZJLkolJTn5ohMde6VYZM9v9q6YLv2LDgk21sYe7qVYAtrcx4SudHIgH+42p+ lcOrZNAhyJZJPvRdVVE6hUKG+B4oZ6thATFOgLOb1SsFCUrYj1Dx98vvaoxo6kxPFqG6 Ogak3uA6qRrjuI2g73tpMgsoz1a5AeoHD+miQBZRWuH6A3KvACa00HM3snBjwlXJUpZD vaNAKKOR9hR+GFt2x2AMBsu4Z4GrOwYzrLZ1JkdAv1I2sNLPa1H16IVWckhmk/y13V9E WLueXOjOSeu9mwqb94ygbE/Fw7MdL3mSzDIN3PBbvZimqY/3B/RBAZJg8OaG6LR48kxr UWFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=7oJy6GVr359JWrWUZV07xKuvq2SjQvFLzw4IlMjehz4=; b=vpcK7yETuW69vOgUaPo3PIemyo4C+l0YyItRdn9Yv3FJ7n+JewEUiUttOd9z/me6SB 8DB33ehYIMHqwblcfkKk/QZTMZDXeFHgyUiLhnBLlQrxDbrvr1v5Ql0EGPPYI1CHlMOO O9x1z/vV3j3gk3GepLuD6bniRy2BNLGVcAiI1MrBctYWFE9KN/QLglc7ABHmbFTiDK32 vkiuBosEg/aZK80k8+otPiBuglHclB0Ww9X4tvnFndH3fFfAvdAva4RaRFK5h2Nx2Jza u1sZjRokzoI4CPl3AMAwIUQnNwJeUxt+pNnnRnL1KXGrSbrSBwd9N+Hmu+zvldfxYhwZ +APA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dn15-20020a17090794cf00b0076ed46e4446si9551040ejc.81.2022.09.13.04.04.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 04:04:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CC3A385C301 for ; Tue, 13 Sep 2022 11:04:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 5A699385843D for ; Tue, 13 Sep 2022 11:03:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A699385843D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,312,1654588800"; d="scan'208,223";a="82769466" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 13 Sep 2022 03:03:41 -0800 IronPort-SDR: 64B8hYp5OL9wKGk1QR9kEpjhukduW0TM7He4Y3pABqH/NTHH0UTyz4ogsbZv9Zm4KmS/FPYemW Zl06YXjFlSRih/mbavJmDZPvu7h0AG1+kNObY/P6+MyV4syg1bCKJlg4NdRINWujOxGYf1MHNr OUK/T7DoHxI9Z6M2ndON/HrBSx+hmUACogVxfyCtxqyfu7dUSgcay/YOEuBvuKU823LgePhQNr OpZaPi1E7zh3O1Jw8inYEjGkPRRXeC6+P+DKfeYK2kfSGV5Zq5U7SFDIolpVRU9NePpWWjdloz 6V8= Message-ID: <62eb3792-62f6-7ebf-aa41-01d03287b573@mentor.com> Date: Tue, 13 Sep 2022 13:03:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Content-Language: en-US To: From: Paul-Antoine Arras Subject: [OG12][PATCH] openmp: Fix handling of target constructs in static member X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, 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: , Cc: ams@codesourcery.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743852198547369175?= X-GMAIL-MSGID: =?utf-8?q?1743852198547369175?= Hello, This patch intends to backport e90af965e5c by Jakub Jelinek to devel/omp/gcc-12. The original patch was described here: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601189.html Thanks, diff --git gcc/cp/ChangeLog.omp gcc/cp/ChangeLog.omp index 35504f4c92b..c3214f31252 100644 --- gcc/cp/ChangeLog.omp +++ gcc/cp/ChangeLog.omp @@ -1,3 +1,13 @@ +2022-09-09 Paul-Antoine Arras + + Backport from mainline: + 2022-09-07 Jakub Jelinek + + PR c++/106829 + * semantics.cc (finish_omp_target_clauses): If current_function_decl + isn't a nonstatic member function, don't set data.current_object to + non-NULL. + 2022-09-07 Tobias Burnus Backport from mainline: diff --git gcc/cp/semantics.cc gcc/cp/semantics.cc index 7717a820f0d..dad04dc4757 100644 --- gcc/cp/semantics.cc +++ gcc/cp/semantics.cc @@ -9727,16 +9727,15 @@ finish_omp_target_clauses (location_t loc, tree body, tree *clauses_ptr) { omp_target_walk_data data; data.this_expr_accessed = false; + data.current_object = NULL_TREE; - tree ct = current_nonlambda_class_type (); - if (ct) - { - tree object = maybe_dummy_object (ct, NULL); - object = maybe_resolve_dummy (object, true); - data.current_object = object; - } - else - data.current_object = NULL_TREE; + if (DECL_NONSTATIC_MEMBER_P (current_function_decl) && current_class_ptr) + if (tree ct = current_nonlambda_class_type ()) + { + tree object = maybe_dummy_object (ct, NULL); + object = maybe_resolve_dummy (object, true); + data.current_object = object; + } if (DECL_LAMBDA_FUNCTION_P (current_function_decl)) { diff --git gcc/testsuite/ChangeLog.omp gcc/testsuite/ChangeLog.omp index ed42b20b099..9ca4d936ff5 100644 --- gcc/testsuite/ChangeLog.omp +++ gcc/testsuite/ChangeLog.omp @@ -1,3 +1,11 @@ +2022-09-09 Paul-Antoine Arras + + Backport from mainline: + 2022-09-07 Jakub Jelinek + + PR c++/106829 + * g++.dg/gomp/pr106829.C: New test. + 2022-09-07 Tobias Burnus Backport from mainline: diff --git gcc/testsuite/g++.dg/gomp/pr106829.C gcc/testsuite/g++.dg/gomp/pr106829.C new file mode 100644 index 00000000000..0295efb88ee --- /dev/null +++ gcc/testsuite/g++.dg/gomp/pr106829.C @@ -0,0 +1,15 @@ +// PR c++/106829 + +namespace std +{ + template class complex; + template <> struct complex { complex (double); _Complex double d; }; +} +struct S { void static foo (); }; + +void +S::foo () +{ +#pragma omp target + std::complex c = 0.0; +}