From patchwork Tue Jan 22 14:43:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Richard Earnshaw \(lists\)" X-Patchwork-Id: 156301 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp7658404jaa; Tue, 22 Jan 2019 06:43:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN43E13DAy4J2B9Ke9QhkW+zgORxvaQ0kZgf6bbv2j9Eet/rwZAWAsJq1zGQHynCJntTakLY X-Received: by 2002:a63:b24a:: with SMTP id t10mr31244043pgo.223.1548168235542; Tue, 22 Jan 2019 06:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548168235; cv=none; d=google.com; s=arc-20160816; b=fgozH/AjrTskYacVNQV0N0zD9ZHwbnhWyt0S5z3Y/mK54kQ6QDRyXLjlARWzkr+79o kvAakdm+U1uyGL7DnJDx4fvZh1kkMlyJhQvZZJG0xe7WRJhn7pHAJptMjZt1A9/IE9Gs QZe/xrsdPa3ftR8PCFQwS4EDpFr+R5QhMl5uSqAwbsyzYmG1rgCxjtZvnmz3TuZwvaLH 9DJwILE4vTPPZyNSsIs19xbrCJ5H0NZzLNphtjMA9GWk2FoBSfK3lUwnPS2OY1QqYR6m Ps6WcBmeO/rXKukTLYNORpL977aAXtisbzuvneu8YHIKuKxFdHP+X1LTqov3FPJ/5t6x 7r4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:date:message-id:openpgp:subject:from:cc:to :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=wPRLzmHt7zY5dESfGzVpUkaSN3RZOR6Si8wbcWUn70o=; b=cAzf93A2uFJF3mx4sgjA/q/5jQsguS2DwHVYH/iG7CYZl1G+Zh6IvFZ0wVpSJZjiO+ 9gYiNuf/cCUkwzBQF+0uHnubDw0KjU2jKZxnDIGD5s9KIN5Eo9Euvq2FDWFiiG8GqXcv B+S4FDw5qBuJw+ASRE1gzmCOr5rkxHSq1mgmYX/YjFtc481SpgzBdylU0GstzuaVoE9u 4d/vhWLnEjStYngACCr5tGw3ieG+Lk32jYRJjYGDUitOU+jReRseX1OdGHwdl6WoxGha qRHy3OfmJNEpiqGiBif9q+MSXY2zwEWygPQ29cVS2nDOsbUwjL+nZoJJ6yR2N8+KERSh 6nNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=p4IMjwcv; spf=pass (google.com: domain of gcc-patches-return-494521-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-494521-patch=linaro.org@gcc.gnu.org" Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a6si15578397pfo.90.2019.01.22.06.43.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 06:43:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-494521-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=p4IMjwcv; spf=pass (google.com: domain of gcc-patches-return-494521-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-494521-patch=linaro.org@gcc.gnu.org" DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=k5MIQ7qB49x3L54Ml118U3mdg97U40vAs1gJMYTtfFi59wYI6D YdVZ74BnN1Yhjg8rcU6gGZvM7zIVRNgDynMc1PPbeEd0mn5CCyfqq8/aTGBpkiK1 HaY7eqPdlM2WWyJwMtn5fqSYqP/0yHCiwUSaRIC5Xn3RRlQ/E0ZvevPCA= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=QgBz3TDgabZQs6xMHeAJAcrri2I=; b=p4IMjwcvUI5gLGhspsdh i1VhjwX97QlcPbBPsgmRFuot1s4wvlU9GWgz7zy5rxGzAQy/30pxJZkNlOMi/6NU YYImYvE1ZaETlVN1FnCfFqry/YwSKRoVOBXMzVOoZPrOteYR1p271D/9DSOd0zya bhi/+Hw+BWe0eY7l3bFPCrA= Received: (qmail 120091 invoked by alias); 22 Jan 2019 14:43:43 -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 120075 invoked by uid 89); 22 Jan 2019 14:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 22 Jan 2019 14:43:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 635691596; Tue, 22 Jan 2019 06:43:40 -0800 (PST) Received: from e120077-lin.cambridge.arm.com (e120077-lin.cambridge.arm.com [10.2.206.231]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 875D63F589; Tue, 22 Jan 2019 06:43:39 -0800 (PST) To: gcc-patches Cc: jakub@redhat.com, Richard Biener From: "Richard Earnshaw (lists)" Subject: Mitigation for PR target/88469 on arm-based systems bootstrapping with gcc-6/7/8 Openpgp: preference=signencrypt Message-ID: <09d6d715-5fe0-e120-3f28-49297e3535a0@arm.com> Date: Tue, 22 Jan 2019 14:43:38 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 This patch, for gcc 8/9 is a mitigation patch for PR target/88469 where gcc-6/7/8 miscompile a structure whose alignment is dominated by a 64-bit bitfield member. Since the PCS rules for such a type must ignore any overalignment of the base type we cannot address this by simply adding a larger alignment to the class. The simplest fix, therefore, is to insert a dummy field that has 64-bit alignment. Although that field is never used, it does fix the overall alignment of the class at the expense of adding an extra dword of data on ARM systems (I've bounded the range of GCC versions that will lead to this mitigation, so only a stage-1 gcc-9 will see the impact of this change - though gcc-8 will see this in full). OK for trunk/gcc-8? PR target/88469 * profile-count.h (profile_count): Add dummy file with 64-bit alignment on arm-based systems using gcc-6/7/8. diff --git a/gcc/profile-count.h b/gcc/profile-count.h index c83fa3beb8f..ddfda2cddf4 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -645,6 +645,12 @@ private: uint64_t m_val : n_bits; enum profile_quality m_quality : 3; +#if defined (__arm__) && (__GNUC__ >= 6 && __GNUC__ <= 8) + /* Work-around for PR88469. A bug in the gcc-6/7/8 PCS layout code + incorrectly detects the alignment of a structure where the only + 64-bit aligned element is a bit-field. */ + uint64_t m_force_alignment; +#endif /* Return true if both values can meaningfully appear in single function body. We have either all counters in function local or global, otherwise