From patchwork Fri Jun 21 06:54:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1119989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-503419-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="n5ZPat/n"; dkim-atps=neutral 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 45VTvS6XLrz9s4Y for ; Fri, 21 Jun 2019 16:54:44 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=oBZ6gF67e4oeFPZvV8QAo1/A8GHGtQAGqbrdDXV40gD hd6AhklGHMuiorwqvRFe4fT38RFj1QRFAUBxKabnnPzP7FNC+04INKOl7zTJo2Re vc2p57xduhm/1FPUXQV1Rh8xCfHrrccCzGIxmIriL4rBcW1l9BVi0+UujlB3hFjI = 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:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=TN6Z1n3YOiRIeSZFsYq0CHArdKg=; b=n5ZPat/n2x/JNcI7I e53MhdJAQ3YXh2AB8JMOPRGHGM8Vhl1HMW+uA4eyvtMiG88z6mBKoKYQjYf5ZJDI dV0ZBklh8xefiK0jEOhI0zWMzzJpHk5y4gNPeZdGDZWxgOUw76fOKXieyqk8DJlK t3FTq2Hr11CFhMwfygR9jSzssY= Received: (qmail 66921 invoked by alias); 21 Jun 2019 06:54:34 -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 66853 invoked by uid 89); 21 Jun 2019 06:54:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 21 Jun 2019 06:54:32 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82E0E3162909 for ; Fri, 21 Jun 2019 06:54:31 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DDFD5C221 for ; Fri, 21 Jun 2019 06:54:31 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x5L6sTa6006382 for ; Fri, 21 Jun 2019 08:54:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x5L6sR0E006380 for gcc-patches@gcc.gnu.org; Fri, 21 Jun 2019 08:54:27 +0200 Date: Fri, 21 Jun 2019 08:54:27 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix OpenMP reference handling to incomplete type during template processing (PR c++/90950) Message-ID: <20190621065427.GV815@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) X-IsSubscribed: yes Hi! As the testcase shows, if we have a clause with reference to dependent type, during the processing_template_decl finish_omp_clauses we would reject it rather than deferring checking of that until instantiation. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk, queued for backporting to release branches. 2019-06-21 Jakub Jelinek PR c++/90950 * semantics.c (finish_omp_clauses): Don't reject references to incomplete types if processing_template_decl. * g++.dg/gomp/lastprivate-1.C: New test. Jakub --- gcc/cp/semantics.c.jj 2019-06-17 23:18:53.621850057 +0200 +++ gcc/cp/semantics.c 2019-06-20 16:34:11.111784663 +0200 @@ -7831,7 +7831,8 @@ finish_omp_clauses (tree clauses, enum c t = require_complete_type (t); if (t == error_mark_node) remove = true; - else if (TYPE_REF_P (TREE_TYPE (t)) + else if (!processing_template_decl + && TYPE_REF_P (TREE_TYPE (t)) && !complete_type_or_else (TREE_TYPE (TREE_TYPE (t)), t)) remove = true; } --- gcc/testsuite/g++.dg/gomp/lastprivate-1.C.jj 2019-06-20 16:33:28.980441681 +0200 +++ gcc/testsuite/g++.dg/gomp/lastprivate-1.C 2019-06-20 16:37:05.420066376 +0200 @@ -0,0 +1,16 @@ +// PR c++/90950 +// { dg-do compile } + +template +T +foo (void) +{ + T y = 0; + T &x = y; + #pragma omp parallel for lastprivate (x) + for (int i = 0; i < 8; ++i) + x = i; + return x; +} + +int a = foo ();