From patchwork Tue Jul 2 08:33:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1126051 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-504139-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz 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 45dHZg0Gfnz9sLt for ; Tue, 2 Jul 2019 18:33:44 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=xvl38NgHQhajAGqBKeGEX9ZpU2lKxjo0X/ZRLGmKQH+ocaYJ2MMLz MuEqhaZulFRTubLDcwtCNg69d9jnJUlqU+6OEQxr4cSikkHWjBStpb78MRzgt4x2 aOeF/U/cwrPNm6nSUChn9pSt/YWyl6pUb2Ki6ftW1FHEJDE7PkLncs= 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:subject:message-id:mime-version:content-type; s= default; bh=RGhRBahhi4596x67mrZMsl+QSKo=; b=EZy67KBCzrbIaUrMBotj h6vHUgqYmBfH77wakkjwATOjp51OtKBbk5bSS2ZOV5TymXCZx9VXo9P81+D3dhFn hN5NbS1ewtlggACVc2OgyQH+zpkHye4/0lhYln2mxIaWepXPRpdqssXBTi+uk+qp 8Rctx6EljSFg97ub0NvewdE= Received: (qmail 81242 invoked by alias); 2 Jul 2019 08:33:37 -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 81127 invoked by uid 89); 2 Jul 2019 08:33:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy= 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 ESMTP; Tue, 02 Jul 2019 08:33:36 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id DA39228083C; Tue, 2 Jul 2019 10:33:33 +0200 (CEST) Date: Tue, 2 Jul 2019 10:33:33 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix TYPE_CXX_ODR_P mismatch on aarch64 Message-ID: <20190702083333.pjx4hncyrloasnjs@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, on aarch64 we get ICEs with -flto because pre-streamed va_arg type becames main variant of the va_arg types read from the LTO stream. If the LTo stream was produced by C++ then the variants have CXX_ODR_P while the main variant, produced by lto frontend is !CXX_ODR_P. This is harmless because we care about this flag on main variants only but type verifier is not happy. This patch simply copies the flag from main variant (after streaming is done so we do not mess up with type merging). Bootstrapped/regtested aarch64-linux, comitted. * lto-common.c (lto_register_canonical_types_for_odr_types): Copy CXX_ODR_P from the main variant. Index: lto/lto-common.c =================================================================== --- lto/lto-common.c (revision 272852) +++ lto/lto-common.c (working copy) @@ -568,8 +568,17 @@ /* Register all remaining types. */ FOR_EACH_VEC_ELT (*types_to_register, i, t) - if (!TYPE_CANONICAL (t)) - gimple_register_canonical_type (t); + { + /* For pre-streamed types like va-arg it is possible that main variant + is !CXX_ODR_P while the variant (which is streamed) is. + Copy CXX_ODR_P to make type verifier happy. This is safe because + in canonical type calculation we only consider main variants. + However we can not change this flag before streaming is finished + to not affect tree merging. */ + TYPE_CXX_ODR_P (t) = TYPE_CXX_ODR_P (TYPE_MAIN_VARIANT (t)); + if (!TYPE_CANONICAL (t)) + gimple_register_canonical_type (t); + } }