From patchwork Thu Oct 25 15:57:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 194247 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]) by ozlabs.org (Postfix) with SMTP id 1491C2C00A3 for ; Fri, 26 Oct 2012 02:58:00 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351785481; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=mp+VjVj ppS49wK+gnLs5+DAEnHo=; b=CMmbJKGdWIRFqDYdTPTzRHtZCEvpApZqGhsI8Sy kdQyE2HpQMZYNvsJedTCKtryXpmSYnw8e8lStCJtlnGzsnee7kOcPSAxe5F30+7C I1p78kuEKHnNyG7FS5H/pLlZ0vqqRLrViN+WiE2cVmUEvm8FecQ51MiYc/7XGN3U ODvY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=kxzDSfPEKqxNrkgNaPSTAqt38YsDHnMgV38N68i4DEeW0W7P1G4zCyfoSXzFQV yWLkkJRa3FoAnvpDN2gVAvJZyezwzpfwzz3tckejk0P+9wteI/HgWOKl+fYzZ07a FSF5KcSxHkbtYAk6fpxjYeL7IE68mkwhV1lty1rTREEqM=; Received: (qmail 11287 invoked by alias); 25 Oct 2012 15:57:57 -0000 Received: (qmail 11272 invoked by uid 22791); 25 Oct 2012 15:57:56 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Oct 2012 15:57:49 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9PFvnBg009400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Oct 2012 11:57:49 -0400 Received: from [10.3.113.73] (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9PFvlnZ001866 for ; Thu, 25 Oct 2012 11:57:48 -0400 Message-ID: <5089617B.7050103@redhat.com> Date: Thu, 25 Oct 2012 11:57:47 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: Small C++ PATCH to fix OpenMP threadprivate with templates 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 Threadprivate was complaining about a template-id being an incomplete type, because we weren't calling complete_type to instantiate it. Tested x86_64-pc-linux-gnu, applying to trunk. commit 055a6956282763467ce0b84776dbb49e89c5a347 Author: Jason Merrill Date: Mon Oct 15 11:06:25 2012 -0700 * semantics.c (finish_omp_threadprivate): Call complete_type. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 63b364c..073ee97 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4360,7 +4360,7 @@ finish_omp_threadprivate (tree vars) error ("%qE declared % after first use", v); else if (! TREE_STATIC (v) && ! DECL_EXTERNAL (v)) error ("automatic variable %qE cannot be %", v); - else if (! COMPLETE_TYPE_P (TREE_TYPE (v))) + else if (! COMPLETE_TYPE_P (complete_type (TREE_TYPE (v)))) error ("% %qE has incomplete type", v); else if (TREE_STATIC (v) && TYPE_P (CP_DECL_CONTEXT (v)) && CP_DECL_CONTEXT (v) != current_class_type) diff --git a/gcc/testsuite/g++.dg/gomp/tls-template1.C b/gcc/testsuite/g++.dg/gomp/tls-template1.C new file mode 100644 index 0000000..5865ce3 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/tls-template1.C @@ -0,0 +1,13 @@ +// { dg-require-effective-target tls } + +template struct B +{ + T t; +}; + +class A { + static B b; +#pragma omp threadprivate(b) +}; + +B A::b; diff --git a/libgomp/testsuite/libgomp.c++/tls-init1.C b/libgomp/testsuite/libgomp.c++/tls-init1.C index 4cbaccb..d62e96b 100644 --- a/libgomp/testsuite/libgomp.c++/tls-init1.C +++ b/libgomp/testsuite/libgomp.c++/tls-init1.C @@ -1,3 +1,5 @@ +// { dg-require-alias } + extern "C" void abort(); struct A