From patchwork Fri Mar 9 12:11:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 883584 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-474489-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="lsiVltVy"; 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 3zyR7V5Jf1z9sbw for ; Fri, 9 Mar 2018 23:11:32 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=mlTGHtCmKJX2iu9a6/mKk9LaTFdubLJvKrgEVT/fxdUry5vKne tvABLeow/gCsRyouMgh6gA1ZCtSwJYn9HIpHsP6uohQ2fz/C/+D3zsc8uIRi0A5x FufYG6jZrIXy8BevuQ/AwEKaBTeppqgk+sbe/KlQw45HUFLTphmeKU6VQ= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=ZCcdawM8EnRIvrvZ7giteejqq8Y=; b=lsiVltVyd+kNcjhESGcD sKvbjssNQ2ILRHWnQFv5wz+odaeQvZR7JpI+3PMwirkNSVnws0aVNuE/6+znWa6K nuB6Do9jgMerY6VghhFEAJLnjokTcbThrtPuzkJ+rXTPfcxnAHwZoadc/OCnu8cz XRA6aWU986lNToVydaUb4HM= Received: (qmail 90763 invoked by alias); 9 Mar 2018 12:11:21 -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 90598 invoked by uid 89); 9 Mar 2018 12:11:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yb0-f170.google.com Received: from mail-yb0-f170.google.com (HELO mail-yb0-f170.google.com) (209.85.213.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Mar 2018 12:11:18 +0000 Received: by mail-yb0-f170.google.com with SMTP id a17-v6so536106ybm.6 for ; Fri, 09 Mar 2018 04:11:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=XIoYVIUyQzpTawnW/SjHDYsYBhUSPqvBmCIZtH0IcO0=; b=gyet1ldBby2HaBRHmS8bmZAZO4W8mYAquWrfUdQ9ZHJgvL/qQ+1MzT0F0phyGFrVbL 1wnr5XrL5U702q6UOMcqwXeVEr51o6EDAYEufsb+/tGKFIrYPfE1QoU/O3W6GJ8HvLOm t/qWIOouAU48tHihHssjZhvT56gCJpQwNx/iLieXRjELw9WnsuZhZaPRAEzSfU3Yj357 oTt40fusfx9LKi/19pb485GLzfX96VOw/A13k5Q30ran9aGaiQexhEQPqTzDYCW5DQEC HoIJ3uao+XgIHJkqpBBtlx4WWlj5iu02pyUti4JP13KT81yQnKBRZEf8y+vQap2UGTig MupQ== X-Gm-Message-State: AElRT7E4bpqRiOPpAd7E/9jyVlHWTv0rhCsZm0cJnbMkoEl7smHlNu6c Jn0CNWFev+g9pmFWe+yC0wg= X-Google-Smtp-Source: AG47ELvFqFe65w+g5OwyDzbYzo4nk97tfgDy6bQb+4cJsd2OmyHK1lJBCwA+qz8rodtLmxU4TgpFZQ== X-Received: by 2002:a25:c3c2:: with SMTP id t185-v6mr13537644ybf.487.1520597476843; Fri, 09 Mar 2018 04:11:16 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::5ac2]) by smtp.googlemail.com with ESMTPSA id l134sm259050ywe.103.2018.03.09.04.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 04:11:15 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [PR c++/84733] ICE in check-local-shadow Message-ID: <48f1cec3-89b4-8208-0044-7ad7520588e8@acm.org> Date: Fri, 9 Mar 2018 07:11:13 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 This patch fixes the ICE in check-local-shadow, but reverts behaviour to the earlier ICE in pop_local_binding. Check local shadow had a check when finding an outer local scope for function_parm_scope. But that code didn't make sense and was unreachable with the current testsuite. So I removed it. However, this testcase needed it. It needed it because do_pushdecl_with_scope clears current_function_decl, even if the scope being pushed into happens to be the same function. And in all uses cases, we're either pushing into a namespace scope (so it should be cleared) or pushig into a class scope (so it should be unchanged). The code in pushtag that does this looks funky. I don;t think we do the same when pushing non-tags, and that's weird. Probably related to the older ICE in pop_local_binding. That happens because we're popping the VAR_DECL for 'e' but find the TYPE_DECL -- somethings getting the ordering wrong. I was unable to find a testcase that triggered the new ice without also triggering the old ice. I'm leaving the bug open, but with a simpler testcase. At least the regression is fixed. nathan 2018-03-09 Nathan Sidwell PR c++/84733 * name-lookup.c (do_pushdecl_with_scope): Only clear current_function_decl when pushing a non-class (i.e. namespace) scope. Index: cp/name-lookup.c =================================================================== --- cp/name-lookup.c (revision 258338) +++ cp/name-lookup.c (working copy) @@ -3965,9 +3965,7 @@ static tree do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend) { cp_binding_level *b; - tree function_decl = current_function_decl; - current_function_decl = NULL_TREE; if (level->kind == sk_class) { b = class_binding_level; @@ -3977,12 +3975,15 @@ do_pushdecl_with_scope (tree x, cp_bindi } else { + tree function_decl = current_function_decl; + if (level->kind == sk_namespace) + current_function_decl = NULL_TREE; b = current_binding_level; current_binding_level = level; x = pushdecl (x, is_friend); current_binding_level = b; + current_function_decl = function_decl; } - current_function_decl = function_decl; return x; }