From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 8798A39450DE for ; Tue, 15 Sep 2020 15:00:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8798A39450DE Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qt1-x82d.google.com with SMTP id n18so3423215qtw.0 for ; Tue, 15 Sep 2020 08:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=ov91+K5mpW9XmySgorhoJ3QNoRlETEieJeVTbaDy2LU=; b=NGoMCXDNrS4C6MVIeJvjZCDn8vXEGRvBG6jmMWFZ0EIkmKCQpQSgCJWErkejPJSpfL r6+0QNiwB+IRmbXlQR+TCbu7K2jSYVajzzL9Xal3TIC6MhuibMHB2uoK6oSjwAloxENv fYO5Se+WUJ86hJvzlanAYNiNzKlobUcSGIfOOFMwAlNutvmkO9NWq8AwrF4yoaQ/WosG tuvYk4b38xOixydxyyAXnmg3Z2dD+bQlqGEe2VIUs1lZMudVSDoLiK47/ZYjNPd+a86p eE3IPUfKN7AqeVB5BYGT4CskI9DddatOsyDNUzOZi8dShynMwHN+jluaNMeS7CQ6AvLB UKXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=ov91+K5mpW9XmySgorhoJ3QNoRlETEieJeVTbaDy2LU=; b=MeREYB2s15re+uqFKMTzkOKWZcHK+1to8UAVd3aMVNqQxT+ZosBdMGfasXyaqWtH3J wnanPWSeq+/AzUBVgrG+kmobXDluYT+SC4zR9Eeh/QtGRmMdoa9v4jsJzGpcLIXfVSZU /S05kGBc4FeyOVEjUE6pzZjJawEZAQ7X2BYO54397sTfYgXMKM1t9f2E1/97StoLvftn 9RMG7BX+c/ZD6fRO2LGFVpKFrRSJkf6T79gRo94BW5Ulgxc3hbC8i4ke2DQ1ReT56jyW zVYEZFll+XBzWRhYbEfccljXlKgau00b1A2myrkvti7+BbyIOciTQU+UDp/TOZPu0IY1 q+UA== X-Gm-Message-State: AOAM530fMU0UHodkovYMAevoiLpmKKbousnclpZDplMYaaRf7s0BvtiN FHcajDLwTScTtOlxpt23Wlg= X-Google-Smtp-Source: ABdhPJx93A8/H1VA33AxP+Lo7cKN6/dj7p1pdO7fIHrRk9gDIq9/rgm+jY2TeSGXI0xrINz3SKGuTQ== X-Received: by 2002:ac8:120a:: with SMTP id x10mr18058173qti.88.1600182053743; Tue, 15 Sep 2020 08:00:53 -0700 (PDT) Received: from ?IPv6:2620:10d:c0a8:1102:1d4d:65f5:5194:47e2? ([2620:10d:c091:480::1:6320]) by smtp.googlemail.com with ESMTPSA id o35sm5255588qte.23.2020.09.15.08.00.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Sep 2020 08:00:52 -0700 (PDT) Sender: Nathan Sidwell Subject: Re: c++: local externs in templates do not get template head To: Tobias Burnus , GCC Patches Cc: Jakub Jelinek References: <0de116c2-d345-12fe-1efe-b4a545b4bd87@acm.org> From: Nathan Sidwell Message-ID: <842d46d3-38ac-02fa-aba0-dab481ca32a3@acm.org> Date: Tue, 15 Sep 2020 11:00:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------7153D2B7D488556659546D23" Content-Language: en-US X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Tue, 15 Sep 2020 15:01:01 -0000 This is a multi-part message in MIME format. --------------7153D2B7D488556659546D23 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 9/14/20 6:47 PM, Tobias Burnus wrote: > This patch cause run-time fails for >   g++ -fopenmp libgomp/testsuite/libgomp.c++/udr-13.C > > The follow-up fix does not help. > > Namely, in udr-3.C:115: > > 115             if (t.s != 11 || v.v != 9 || q != 0 || d != 3.0) abort (); > (gdb) p t.s oops, I forgot the runtime tests are there -- it was so long ago! This unbreaks it, while I go develop a more robust patch. Turns out I didn't get OMP reductions correct. To address those I need to do some reorganization, so this patch just reverts the OMP-specific pieces of the local decl changes. gcc/cp/ * pt.c (push_template_decl_real): OMP reductions retain a template header. (tsubst_function_decl): Likewise. pushed to trunk nathan -- Nathan Sidwell --------------7153D2B7D488556659546D23 Content-Type: text/x-patch; charset=UTF-8; name="omp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="omp.diff" diff --git c/gcc/cp/pt.c w/gcc/cp/pt.c index c630ef5a070..1aea105edd5 100644 --- c/gcc/cp/pt.c +++ w/gcc/cp/pt.c @@ -6072,9 +6072,11 @@ push_template_decl_real (tree decl, bool is_friend) if (is_primary) retrofit_lang_decl (decl); if (DECL_LANG_SPECIFIC (decl) - && (!VAR_OR_FUNCTION_DECL_P (decl) - || !ctx - || !DECL_LOCAL_DECL_P (decl))) + && !(VAR_OR_FUNCTION_DECL_P (decl) + && DECL_LOCAL_DECL_P (decl) + /* OMP reductions still need a template header. */ + && !(TREE_CODE (decl) == FUNCTION_DECL + && DECL_OMP_DECLARE_REDUCTION_P (decl)))) DECL_TEMPLATE_INFO (decl) = info; } @@ -13712,7 +13714,8 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, gcc_assert (DECL_TEMPLATE_INFO (t) != NULL_TREE || DECL_LOCAL_DECL_P (t)); - if (DECL_LOCAL_DECL_P (t)) + if (DECL_LOCAL_DECL_P (t) + && !DECL_OMP_DECLARE_REDUCTION_P (t)) { if (tree spec = retrieve_local_specialization (t)) return spec; @@ -13967,7 +13970,8 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, && !uses_template_parms (argvec)) tsubst_default_arguments (r, complain); } - else if (DECL_LOCAL_DECL_P (r)) + else if (DECL_LOCAL_DECL_P (r) + && !DECL_OMP_DECLARE_REDUCTION_P (r)) { if (!cp_unevaluated_operand) register_local_specialization (r, t); --------------7153D2B7D488556659546D23--