From patchwork Fri Nov 9 09:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 995394 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-489479-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GH1dssvK"; 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 42rvJn52mFz9s89 for ; Fri, 9 Nov 2018 20:01:13 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=v/UqJAYCWbyQk943ROAipmSsHCO2KpfFrQD8lhDMRtPga1qGT3odC HruIQl3XYB+fXjMAAatYTvInDreJlQUymejiu+0YEsD9sB5tPzB/CIGRLC4KDkIR Zq5ZSxU9pIlZLic8cJXCew2ue1jCW3iIZKdb6/QaqgfraCT878MGzY= 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=WzxNgIY5QIDWt3OHumxKVlORtrk=; b=GH1dssvKi36Cy0K4blyJ zT76El3603V/Pe7T/nOAbQG2kQmT2am/0bnTSW/ANeSAf0yjRZLSc20ACQk0R5CL CN/GJb8fRotea0B0PSfGr3oflhvFwsGJOr9AOjHalxRf5oHrUAygItpnVY3xjBod 5WCBrqMjMJqwzyI6Bj+S4uc= Received: (qmail 8431 invoked by alias); 9 Nov 2018 09:00:49 -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 8108 invoked by uid 89); 9 Nov 2018 09:00:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 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; Fri, 09 Nov 2018 09:00:18 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id DAB5E28050C; Fri, 9 Nov 2018 10:00:08 +0100 (CET) Date: Fri, 9 Nov 2018 10:00:08 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de Subject: Fix handling of TYPE_USER_ALIGN Message-ID: <20181109090008.v7mxj5dp2gnu5tzb@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, this patch fixes handling of TYPE_USER_ALIGN. I tried to drop it completely from LTO streaming and clear it in free lang data but it breaks one ubsan testcase: FAIL: c-c++-common/ubsan/pr63802.c -O2 -flto -fno-use-linker-plugin -flto-partition=none output pattern test FAIL: c-c++-common/ubsan/pr63802.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects output pattern test lto-bootstrapped/regtested x86_64-linux, OK? Honza * tree.c (fld_type_variant_equal_p): Test user align flag. (flt_type_variant): Copy user align flag. (fld_incomplete_type_of): Clear it. Index: tree.c =================================================================== --- tree.c (revision 265914) +++ tree.c (working copy) @@ -5109,7 +5109,8 @@ fld_type_variant_equal_p (tree t, tree v /* We want to match incomplete variants with complete types. In this case we need to ignore alignment. */ || ((!RECORD_OR_UNION_TYPE_P (t) || COMPLETE_TYPE_P (v)) - && TYPE_ALIGN (t) != TYPE_ALIGN (v)) + && (TYPE_ALIGN (t) != TYPE_ALIGN (v) + || TYPE_USER_ALIGN (t) != TYPE_USER_ALIGN (v))) || fld_simplified_type_name (t) != fld_simplified_type_name (v) || !attribute_list_equal (TYPE_ATTRIBUTES (t), TYPE_ATTRIBUTES (v))) @@ -5140,7 +5141,10 @@ fld_type_variant (tree first, tree t, st /* Variants of incomplete types should have alignment set to BITS_PER_UNIT. Do not copy the actual alignment. */ if (!RECORD_OR_UNION_TYPE_P (v) || COMPLETE_TYPE_P (v)) - SET_TYPE_ALIGN (v, TYPE_ALIGN (t)); + { + SET_TYPE_ALIGN (v, TYPE_ALIGN (t)); + TYPE_USER_ALIGN (v) = TYPE_USER_ALIGN (t); + } gcc_checking_assert (fld_type_variant_equal_p (t,v)); add_tree_to_fld_list (v, fld); return v; @@ -5194,6 +5198,7 @@ fld_incomplete_type_of (tree t, struct f TYPE_SIZE (copy) = NULL; SET_TYPE_MODE (copy, VOIDmode); SET_TYPE_ALIGN (copy, BITS_PER_UNIT); + TYPE_USER_ALIGN (copy) = 0; TYPE_SIZE_UNIT (copy) = NULL; TYPE_CANONICAL (copy) = TYPE_CANONICAL (t); TYPE_TYPELESS_STORAGE (copy) = 0;