From patchwork Thu Jun 8 13:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 773198 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 3wk6CZ52YQz9s5L for ; Thu, 8 Jun 2017 23:46:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fd7WljBQ"; 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:date :from:to:cc:subject:in-reply-to:message-id:references :mime-version:content-type; q=dns; s=default; b=y1zL/WFV0ySNxYFc FvsAbBB2TK+WkAcsIJGdjUnTcWzdpZRr3qGaVDPaKtG+pCdEwSsfWdW/hG4eEi7n SG5iS0ZqWA69RdNGjRklX2JQ6QqnhCOxRB1U86IzapFCLfUaIKTaK1UBKL+7USeN 0Y1mYsP9+Yy9SXk8JV3JCT0uSMQ= 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:in-reply-to:message-id:references :mime-version:content-type; s=default; bh=uuAwJDTkZRwYnkV/YBiKCK etRpc=; b=fd7WljBQQCoStYSDr/dvnzWtIJWyNcOT5RQyMu0liDfe0V8eyAI4v1 T4a9ciMalS0wNWOyg6K/N6aB04nWjWN4CH4sOztplbFSNHNGWoOVYWuYiTy12/0E ZWIiKttlQfOeIWJmzDQgAXx4Y7lejiDycKex5XaeGnX0WqM47iIuM= Received: (qmail 114497 invoked by alias); 8 Jun 2017 13:46:18 -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 114013 invoked by uid 89); 8 Jun 2017 13:46:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Jun 2017 13:46:15 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8AE05AB09; Thu, 8 Jun 2017 13:46:17 +0000 (UTC) Date: Thu, 8 Jun 2017 15:46:17 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek Subject: Re: [PATCH] Fix PR81007 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 On Thu, 8 Jun 2017, Richard Biener wrote: > On Thu, 8 Jun 2017, Richard Biener wrote: > > > > > Folding during gimplification can invoke the devirt machinery which > > doesn't deal with errorneous state. Thus avoid ICEing by not folding > > from gimplification in case we've seen errors. > > > > Similarly do not build cgraph edges in those cases as that invokes > > the devirt machinery as well (we stop compilation after lowering anyway > > in case errors were reported). > > > > The patch also fixes ordering of passes. > > > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > Bah. The cgraphbuild.c hunks cause > > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 111) > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 111) > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 63) > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 82) > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 90) > FAIL: g++.dg/gomp/linear-2.C -std=gnu++11 (test for errors, line 90) > ... > > looks like the code processing queued cgraph nodes enqueues > further nodes by looking at callees and thus omp lowering > doesn't register split out functions with the cgraph? > > No time to dig in right now. > > But relying on the folding machinery not to ICE looks fragile to me. > Eventually, given the ICE is reached by cgraph edge building, we > have to plug that hole anyways. So I'm testing the following instead. Richard. 2017-06-08 Richard Biener PR middle-end/81007 * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class): Skip FIELD_DECLs with error_mark_node type. * passes.def (all_lowering_passes): Run pass_build_cgraph_edges last again. * g++.dg/pr81007.C: New testcase. Index: gcc/ipa-polymorphic-call.c =================================================================== --- gcc/ipa-polymorphic-call.c (revision 249003) +++ gcc/ipa-polymorphic-call.c (working copy) @@ -267,7 +267,8 @@ ipa_polymorphic_call_context::restrict_t { for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) { - if (TREE_CODE (fld) != FIELD_DECL) + if (TREE_CODE (fld) != FIELD_DECL + || TREE_TYPE (fld) == error_mark_node) continue; pos = int_bit_position (fld); Index: gcc/passes.def =================================================================== --- gcc/passes.def (revision 249003) +++ gcc/passes.def (working copy) @@ -42,9 +42,9 @@ along with GCC; see the file COPYING3. NEXT_PASS (pass_build_cfg); NEXT_PASS (pass_warn_function_return); NEXT_PASS (pass_expand_omp); - NEXT_PASS (pass_build_cgraph_edges); NEXT_PASS (pass_sprintf_length, false); NEXT_PASS (pass_walloca, /*strict_mode_p=*/true); + NEXT_PASS (pass_build_cgraph_edges); TERMINATE_PASS_LIST (all_lowering_passes) /* Interprocedural optimization passes. */ Index: gcc/testsuite/g++.dg/pr81007.C =================================================================== --- gcc/testsuite/g++.dg/pr81007.C (nonexistent) +++ gcc/testsuite/g++.dg/pr81007.C (working copy) @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-O2" } + +struct A +{ + A p; // { dg-error "incomplete" } + virtual void foo(); +}; + +struct B : A {}; + +void bar(B& b) +{ + b.foo(); +}