From patchwork Mon Mar 12 23:06:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 884943 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-474622-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jyIsgnUw"; 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 400YYB50dnz9sSh for ; Tue, 13 Mar 2018 10:07:41 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=d0VGYOs7uVOvVwAN IlPzA9juJS/p/TE+9a1vUq+zx7tz1FPS4SUzB9wz8udtxVMdUP2vYcXLXsb/E+KK GbUFBiheIWSmelXPyyVxw8a6suJWU3lWRBBBaRqmfbMZl5xD523fIC/VsjwxM5Yu GA4SS4rRW7KCBBLpNIXrPw9vUSY= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=1dlF9AUdMXMLXtQteELGMC GqGnM=; b=jyIsgnUwy8bdQ2ARQ27QwIDGsCu1aAW4XRLxQlm7xKKA7LgYa0sBss 6GpMKyjDYz1F6dUERRIdlNC0rtHOshgfmA3hapzhZhO3bk84u1o+Vbb0TfJwwtpF E8uBy51f4MVQwH2b3dQj2PwgHIc1SqejBH0OawdZObl5zHOP56Xww= 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-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 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: Tue, 13 Mar 2018 00:06:55 +0100 Message-ID: <4113462.IWbXHliYRW@polaris> MIME-Version: 1.0 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. 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;