From patchwork Thu Nov 26 06:32:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 548934 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 351FB1402B8 for ; Thu, 26 Nov 2015 17:33:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=OQdC4EoY; 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:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=Tu4RDYCN+BDK99XxL dRRgniYR0UCsvJjfy+BYmePs6NjCq1G7dw8+Y8g4oMOnII8p1iBethW58MyRvBOu Uf2xYddDF0WdkNUlJAiJVc+gaN2BiG6y+K8W2iFrSZpruxwIrimzCv6J/VIwXnty TjCHiLBQh4df8opAaZoueXwK4M= 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:references:mime-version :content-type:in-reply-to; s=default; bh=cmwPdZMjqob3cMfJXQrULSZ J4Uw=; b=OQdC4EoYETbPnUhiCnFZBQ6/E5Kcz98HV3tBcI0rrHuH1gaoA2BnSA9 IbEvQKs/iQ3V+Mk2iSV0ZwCpoMFtbYhRFzLa4k6XwNyX8nsR14RO47etAUZAbLPO I3rttb6tiUMMm7DdzsgxF4ZGmN2bdFJUodznvaAALwKorVlXMBgc= Received: (qmail 44143 invoked by alias); 26 Nov 2015 06:33:04 -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 44133 invoked by uid 89); 26 Nov 2015 06:33:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 26 Nov 2015 06:33:01 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id F1952545392; Thu, 26 Nov 2015 07:32:57 +0100 (CET) Date: Thu, 26 Nov 2015 07:32:57 +0100 From: Jan Hubicka To: Jan Hubicka Cc: Jason Merrill , gcc-patches List Subject: Re: RFA: PATCH to gimple_canonical_types_compatible_p for middle-end/66214 Message-ID: <20151126063257.GA59662@kam.mff.cuni.cz> References: <5655DA06.4000506@redhat.com> <20151125191010.GA5371@kam.mff.cuni.cz> <56563234.8040404@redhat.com> <20151125221451.GE20593@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151125221451.GE20593@kam.mff.cuni.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Hi, what aout this? Index: tree.c =================================================================== --- tree.c (revision 230924) +++ tree.c (working copy) @@ -13424,6 +13424,12 @@ gimple_canonical_types_compatible_p (con { tree f1, f2; + /* Don't try to compare variants of an incomplete type, before + TYPE_FIELDS has been copied around. */ + if (!COMPLETE_TYPE_P (t1) && !COMPLETE_TYPE_P (t2)) + return true; + + if (TYPE_REVERSE_STORAGE_ORDER (t1) != TYPE_REVERSE_STORAGE_ORDER (t2)) return false; @@ -13710,28 +13716,35 @@ verify_type (const_tree t) } } else if (RECORD_OR_UNION_TYPE_P (t)) - for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) - { - /* TODO: verify properties of decls. */ - if (TREE_CODE (fld) == FIELD_DECL) - ; - else if (TREE_CODE (fld) == TYPE_DECL) - ; - else if (TREE_CODE (fld) == CONST_DECL) - ; - else if (TREE_CODE (fld) == VAR_DECL) - ; - else if (TREE_CODE (fld) == TEMPLATE_DECL) - ; - else if (TREE_CODE (fld) == USING_DECL) - ; - else - { - error ("Wrong tree in TYPE_FIELDS list"); - debug_tree (fld); - error_found = true; - } - } + { + if (TYPE_FIELDS (t) && !COMPLETE_TYPE_P (t) && in_lto_p) + { + error ("TYPE_FIELDS defined in incomplete type"); + error_found = true; + } + for (tree fld = TYPE_FIELDS (t); fld; fld = TREE_CHAIN (fld)) + { + /* TODO: verify properties of decls. */ + if (TREE_CODE (fld) == FIELD_DECL) + ; + else if (TREE_CODE (fld) == TYPE_DECL) + ; + else if (TREE_CODE (fld) == CONST_DECL) + ; + else if (TREE_CODE (fld) == VAR_DECL) + ; + else if (TREE_CODE (fld) == TEMPLATE_DECL) + ; + else if (TREE_CODE (fld) == USING_DECL) + ; + else + { + error ("Wrong tree in TYPE_FIELDS list"); + debug_tree (fld); + error_found = true; + } + } + } else if (TREE_CODE (t) == INTEGER_TYPE || TREE_CODE (t) == BOOLEAN_TYPE || TREE_CODE (t) == OFFSET_TYPE