From patchwork Tue Sep 6 07:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp508380wrt; Tue, 6 Sep 2022 00:34:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4RbCvFkR7I9A+Q66RQvjYU2WblrFaRn0VkDVsUrE0nuGR45odsCVLKBy7Yl4GvuMDq2hUb X-Received: by 2002:a17:907:968a:b0:741:70a5:88f1 with SMTP id hd10-20020a170907968a00b0074170a588f1mr28787083ejc.258.1662449687524; Tue, 06 Sep 2022 00:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662449687; cv=none; d=google.com; s=arc-20160816; b=UwPk1E82Ae1O6m1bcOnxcpp1CleyLfex2s3UqAqxZH4fB7l8oI4a0lcIo+zuTadzTY ZWj9HjDL1I+ii1NssJ4D5jezFCGxtIY8onV3QZbbioKJ9EG1LOC5Q7fm4fi7zqWvp768 wBxvo1Cv453kKwcN41eXs4hS6oTlPubjxRyISjIIqGuWDqb7OEUyBQHF0nADFfcBUH18 RbjzOJ9YiAmZgtVl7wMEX2bwNScrvaksEQPKzon7je3iS/0byndBJxKJqrtx9BUoK9LH aDzblbQF4yyTKjXWRc2a4I9RNmLl7PFQrjSsE0cfHBm81/FaOMMkgX1TTlCQSKFk4f5P HKhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=o4auQLypePmHGnS130w95yEPFoFN+K/YZFAtyL1CSqk=; b=IDgGXj8ZUUuSPBDzKRhzbBY1BlVddfDEThwZASpb5ODh/v+DkbmXKOLmFzJHRfM84a DkWeGIWuxnaoEXjaQIHpFtbYJlUzanWhGFTe6UcvFfuNr6407/jrh9Rog0LniVwF0Voh qbe2eyEAMkhQGvcSh9ZkZD4d7niv7o4D4ARA56178uCGcIFFM2+NyW+4mWCzJBgGL8el xb2MbYgB6sbS3Un4PbRxpHk6feqEpOvAZzJTV9Ae2p9XPMkRgSt42n2LamSlHy1HXvI4 N1cVDIuLV/maKzeshsYyMmWDRyjoReOfFMYuXdyMAZqLNrtVJsat96mP6GqW9mcRE/Ed 7NJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=UdGr4EZS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id cw6-20020a170906478600b0073dc89e51b3si10680706ejc.87.2022.09.06.00.34.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:34:47 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=UdGr4EZS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 450C83887F68 for ; Tue, 6 Sep 2022 07:30:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 450C83887F68 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662449429; bh=o4auQLypePmHGnS130w95yEPFoFN+K/YZFAtyL1CSqk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=UdGr4EZSYfdFvvlv+qxEeu7CgpkwekyFTh70y9lIX3DTiSbNLJNM/oyUSET60+WDT E5wjfMulkIVg5/aTuM6QPM0mlgHV43ve5UybnwRpWgzwwLTZfhwK3vCSSWGo0/5pxj 3oC4RSO3jSUuCfGcsjoXYMcNG5w7JolkpVVv2KKA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5F1A7384B80F for ; Tue, 6 Sep 2022 07:29:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F1A7384B80F Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588--u03WxUxPtyH6LaBKvyCFQ-1; Tue, 06 Sep 2022 03:29:42 -0400 X-MC-Unique: -u03WxUxPtyH6LaBKvyCFQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E904101A54E; Tue, 6 Sep 2022 07:29:42 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 271752166B26; Tue, 6 Sep 2022 07:29:42 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2867Tcg12016675 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 6 Sep 2022 09:29:39 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2867TcKm2016674; Tue, 6 Sep 2022 09:29:38 +0200 Date: Tue, 6 Sep 2022 09:29:37 +0200 To: gcc-patches@gcc.gnu.org Subject: [committed] openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec) [PR106836] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Tobias Burnus 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?1743204843160265323?= X-GMAIL-MSGID: =?utf-8?q?1743204843160265323?= Hi! As we now create OMP_CLAUSE_DOACROSS rather than OMP_CLAUSE_DEPEND when depend is used with source/sink modifiers, c_omp_split_clauses can see OMP_CLAUSE_DOACROSS clause too before we diagnose it as erroneous. The following patch treats it like OMP_CLAUSE_DEPEND during the splitting but adds an assertion. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2022-09-06 Jakub Jelinek PR c/106836 * c-omp.cc (c_omp_split_clauses): Handle OMP_CLAUSE_DOACROSS. * c-c++-common/gomp/pr106836.c: New test. Jakub --- gcc/c-family/c-omp.cc.jj 2022-09-03 09:41:34.846006111 +0200 +++ gcc/c-family/c-omp.cc 2022-09-05 15:00:00.386360743 +0200 @@ -1877,6 +1877,12 @@ c_omp_split_clauses (location_t loc, enu case OMP_CLAUSE_DEPEND: s = C_OMP_CLAUSE_SPLIT_TARGET; break; + case OMP_CLAUSE_DOACROSS: + /* This can happen with invalid depend(source) or + depend(sink:vec) on target combined with other constructs. */ + gcc_assert (OMP_CLAUSE_DOACROSS_DEPEND (clauses)); + s = C_OMP_CLAUSE_SPLIT_TARGET; + break; case OMP_CLAUSE_NUM_TEAMS: s = C_OMP_CLAUSE_SPLIT_TEAMS; break; --- gcc/testsuite/c-c++-common/gomp/pr106836.c.jj 2022-09-05 15:09:28.715774353 +0200 +++ gcc/testsuite/c-c++-common/gomp/pr106836.c 2022-09-05 15:08:49.273300853 +0200 @@ -0,0 +1,9 @@ +/* PR c/106836 */ + +void +foo (void) +{ +#pragma omp target parallel depend (source) /* { dg-error "'depend\\\(source\\\)' is only allowed in 'omp ordered'" } */ + ; +#pragma omp taskwait +}