From patchwork Thu Feb 16 16:38:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 728813 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vPML11R43z9s8S for ; Fri, 17 Feb 2017 03:38:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vNnzNmyy"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=uSPw/nNFkFrBpDSTLY8kIzXLleQu69V/RypKGN6yZ2osQy c8ZG8hO3bPYWvGEXzuI6Oet9gEwT0dnycRy08ci/h5plxJwn8gIQPvaydPLk5p3c 9XikpQ5HJXTyi5ETDSH7DPcJ5kesaesr5t5fQiOf67fJFs9oHhdXophnGcm0w= 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 :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=UGMd5XC1vjZXemY6hRV7Iq0Vttc=; b=vNnzNmyyKlVjenAQhxrJ 0cagdi5SR6K5kRkGMfsUiTe34m7OWKwhTP4UQUkKPv1qbM1esBGvyDby3jnI71JQ qgvHO9YUDo6THhnf2WnWhtdkaXprU0YhoCHhUWjR8NxsIlmxqgeKkiG56WwGL96h ul62ZhCzgNbq7aXwt+rKC1E= Received: (qmail 102428 invoked by alias); 16 Feb 2017 16:38:39 -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 102414 invoked by uid 89); 16 Feb 2017 16:38:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.2 spammy=popped, Hx-languages-length:1605, sk:jasonr, sk:jason@r X-HELO: mail-ot0-f172.google.com Received: from mail-ot0-f172.google.com (HELO mail-ot0-f172.google.com) (74.125.82.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Feb 2017 16:38:37 +0000 Received: by mail-ot0-f172.google.com with SMTP id t47so14670206ota.1 for ; Thu, 16 Feb 2017 08:38:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=E38Txx2lSoXrIuQBNiLWuLTfKjq0grqSllf60uOmBrc=; b=Sz6pHgBeqvzYt3oTmN3MAUpyMga6VECbjr4Y6HoNzPturDJ8rL/+pQSWOjGNZRRCDt 7tBBBSm/JAj4G3h02RcNds/nYZKbmLNmXa44ELWKzc1/1d3x9rOQw3fLw/f/P/FCj0VZ IQOcImjrnZpBrgeC3ToEGs/naM0D5JVEPWrfeADkA16hoYoOwPe1qpJH7SzVlcvV+bAL X2OgLQZ3r9QKllDCWMXOPhyJJdDXyfS9UDXlsYTy2hEIlF/EUcYSwGeda7NK+0i5Kibp m7XzYeMzk8hmbRS3Q3NqzXHDmexbNUFqUZGPqt/S4KWDge8jVIQa0dE/fRYXTUoCDoaP i/Kw== X-Gm-Message-State: AMke39n+TFc93M2UyYJ2uw6eyCXP1DhGkUDVR8umAO/rQTf63cVrCM6wQujBTossVSm67dPVLlv3wsalGhNoZXYb X-Received: by 10.157.43.22 with SMTP id o22mr1880500otb.33.1487263115713; Thu, 16 Feb 2017 08:38:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.5.4 with HTTP; Thu, 16 Feb 2017 08:38:14 -0800 (PST) From: Jason Merrill Date: Thu, 16 Feb 2017 11:38:14 -0500 Message-ID: Subject: C++ PATCH for c++/79050 (ICE with undeduced auto and LTO) To: gcc-patches List X-IsSubscribed: yes LTO doesn't know how to stream undeduced auto, which shows up as a TEMPLATE_TYPE_PARM. Such a declaration isn't useful, since any reference to it would give an error, so let's just remove it from BLOCK_VARS. Tested x86_64-pc-linux-gnu, applying to trunk. commit 3ea102f324537e5706400bfdc8d9f57137877be6 Author: Jason Merrill Date: Wed Feb 15 16:33:00 2017 -0500 PR c++/79050 - ICE with undeduced auto and LTO * decl.c (poplevel): Remove undeduced auto decls. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 353e7b5..70c44fb 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -792,14 +792,17 @@ poplevel (int keep, int reverse, int functionbody) back ends won't understand OVERLOAD, so we remove them here. Because the BLOCK_VARS are (temporarily) shared with CURRENT_BINDING_LEVEL->NAMES we must do this fixup after we have - popped all the bindings. */ + popped all the bindings. Also remove undeduced 'auto' decls, + which LTO doesn't understand, and can't have been used by anything. */ if (block) { tree* d; for (d = &BLOCK_VARS (block); *d; ) { - if (TREE_CODE (*d) == TREE_LIST) + if (TREE_CODE (*d) == TREE_LIST + || (!processing_template_decl + && undeduced_auto_decl (*d))) *d = TREE_CHAIN (*d); else d = &DECL_CHAIN (*d); diff --git a/gcc/testsuite/g++.dg/lto/pr79050_0.C b/gcc/testsuite/g++.dg/lto/pr79050_0.C new file mode 100644 index 0000000..1f31b5d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr79050_0.C @@ -0,0 +1,7 @@ +// PR c++/79050 +// { dg-lto-do assemble } + +int main () +{ + auto foo (); +}