From patchwork Fri Aug 3 09:45:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 953151 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-483095-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="F/WqfMHA"; 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 41hhxz4K05z9ryn for ; Fri, 3 Aug 2018 19:46:15 +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:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=xhMJWVtwyiH7y+QQJJimnqnFeq4TH 9hDvahTtbZlMXrU5bzlZuOcQwYV9BpxAN6BRjoy2WYCDzQnvHbLHfChnSMs/+sOG CevA8e1b65G+mJbPTSTUEUdeu6kADADYDsVfiu1FrUJUYm4kaXo3IKclc4Ek8E7+ kOMWxQkJACJSRw= 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:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=xVj2wQHABJOozgv3z3C1ttIWxkU=; b=F/W qfMHAV1r/JPDncLd+lsctbo6OPjlxADIhe5kxdX0Mj4yAwZTMfHebWqanJej4xCm KinqajnkLzBe7PXfObXe1Wko4cakrd9DcOLUAuItn+H1AxFratMEXrSQFCPWONK8 vRRtzE5/+BF8LEY3swe7XfFqmeuQq9ylaVeIwxrY= Received: (qmail 114853 invoked by alias); 3 Aug 2018 09:45:58 -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 114366 invoked by uid 89); 3 Aug 2018 09:45:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=HTo:D*acm.org, Hx-languages-length:1288 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, 03 Aug 2018 09:45:13 +0000 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE3653082A33; Fri, 3 Aug 2018 09:45:05 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-71.ams2.redhat.com [10.36.117.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 73453D4069; Fri, 3 Aug 2018 09:45:05 +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 w739j2gj008928; Fri, 3 Aug 2018 11:45:03 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w739j1Zs008927; Fri, 3 Aug 2018 11:45:01 +0200 Date: Fri, 3 Aug 2018 11:45:01 +0200 From: Jakub Jelinek To: Jason Merrill , Nathan Sidwell Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix ICE in build_base_path (PR c++/86706) Message-ID: <20180803094501.GM17988@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes Hi! This is Jason's patch from the PR for which I've added a reduced testcase and bootstrapped/regtested on x86_64-linux and i686-linux. Ok for trunk and 8.3 (perhaps after a while)? 2018-07-30 Jason Merrill PR c++/86706 * class.c (build_base_path): Use currently_open_class. * g++.dg/template/pr86706.C: New test. Jakub --- gcc/cp/class.c.jj 2018-07-30 00:21:26.507313463 +0200 +++ gcc/cp/class.c 2018-07-30 00:22:49.184447971 +0200 @@ -278,6 +278,9 @@ build_base_path (enum tree_code code, probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); if (want_pointer) probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe)); + if (dependent_type_p (probe)) + if (tree open = currently_open_class (probe)) + probe = open; if (code == PLUS_EXPR && !SAME_BINFO_TYPE_P (BINFO_TYPE (d_binfo), probe)) --- gcc/testsuite/g++.dg/template/pr86706.C.jj 2018-07-30 11:09:33.002035612 +0200 +++ gcc/testsuite/g++.dg/template/pr86706.C 2018-07-30 11:07:21.069813029 +0200 @@ -0,0 +1,16 @@ +// PR c++/86706 +// { dg-do compile } + +class A { int b; }; + +template +class C : A { C (); static C *f; }; + +template +C *C::f; + +template +C::C () +{ + f->b; +}