From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56392 invoked by alias); 12 Mar 2018 23:07:34 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 56369 invoked by uid 89); 12 Mar 2018 23:07:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Mar 2018 23:07:32 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0B3EF8138B for ; Tue, 13 Mar 2018 00:07:31 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G8rAjoq47t6W for ; Tue, 13 Mar 2018 00:07:30 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id E0C9581345 for ; Tue, 13 Mar 2018 00:07:30 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix PR lto/84805 Date: Mon, 12 Mar 2018 23:07:00 -0000 Message-ID: <4113462.IWbXHliYRW@polaris> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart4158386.fcCKGEN0ES" Content-Transfer-Encoding: 7Bit X-SW-Source: 2018-03/txt/msg00558.txt.bz2 This is a multi-part message in MIME format. --nextPart4158386.fcCKGEN0ES Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 539 Hi, this is an ICE in LTO mode on code violating the ODR rule: get_odr_type checks that there is a sensible internal order between base, type and derived types but this can be easily messed up by incomplete types. Hence the attached fixlet (no testcase because the -Wodr warnings have a totally random order). Tested on x86-64/Linux, OK for the mainline? 2018-03-12 Eric Botcazou PR lto/84805 * ipa-devirt.c (odr_subtypes_equivalent_p): Do not get the ODR type of incomplete types. -- Eric Botcazou --nextPart4158386.fcCKGEN0ES Content-Disposition: attachment; filename="pr84805.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="pr84805.diff" Content-length: 1173 Index: ipa-devirt.c =================================================================== --- ipa-devirt.c (revision 258411) +++ ipa-devirt.c (working copy) @@ -656,7 +656,7 @@ set_type_binfo (tree type, tree binfo) gcc_assert (!TYPE_BINFO (type)); } -/* Compare T2 and T2 based on name or structure. */ +/* Compare T1 and T2 based on name or structure. */ static bool odr_subtypes_equivalent_p (tree t1, tree t2, @@ -678,7 +678,7 @@ odr_subtypes_equivalent_p (tree t1, tree return false; /* For ODR types be sure to compare their names. - To support -wno-odr-type-merging we allow one type to be non-ODR + To support -Wno-odr-type-merging we allow one type to be non-ODR and other ODR even though it is a violation. */ if (types_odr_comparable (t1, t2, true)) { @@ -690,6 +690,8 @@ odr_subtypes_equivalent_p (tree t1, tree therefore which call will report the ODR violation, if any. */ if (!odr_type_p (t1) || !odr_type_p (t2) + || !COMPLETE_TYPE_P (t1) + || !COMPLETE_TYPE_P (t2) || (!get_odr_type (t1, true)->odr_violated && !get_odr_type (t2, true)->odr_violated)) return true; --nextPart4158386.fcCKGEN0ES--