From patchwork Sun Oct 11 16:49:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 1380410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C8STK4z53z9sSG for ; Mon, 12 Oct 2020 03:49:38 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 809993857C6C; Sun, 11 Oct 2020 16:49:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp1.wavenetuk.net (smtp.wavenetuk.net [195.26.36.10]) by sourceware.org (Postfix) with ESMTP id 2088D3857C4E for ; Sun, 11 Oct 2020 16:49:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2088D3857C4E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=iain@sandoe.co.uk Received: from [192.168.1.212] (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp1.wavenetuk.net (Postfix) with ESMTPA id 747D812012D0 for ; Sun, 11 Oct 2020 17:49:32 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [pushed] Objective-C++ : Fix bitfield ivars regression. Message-Id: Date: Sun, 11 Oct 2020 17:49:10 +0100 To: GCC Patches X-Mailer: Apple Mail (2.3273) X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_COUK, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi This fixes a regression present from 8.x; It used to be OK to test for a DECL_INITIAL value to flag that an ivar was a bitfield (the initial value was the width). This still works on C / Objective-C, but no longer on C++. Replace the test with DECL_C_BIT_FIELD() which is set for both C and C++. tested across the Darwin range, and on x86_64-linux pushed to master thanks Iain gcc/objc/ChangeLog: * objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Test DECL_C_BIT_FIELD to detect that an ivar is a bitfield. --- gcc/objc/objc-next-runtime-abi-02.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 60bf86ab8c9..b83c9a31dbf 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -1395,12 +1395,7 @@ objc_v2_build_ivar_ref (tree datum, tree component) return NULL_TREE; /* This routine only handles non-bitfield fields */ - /* DECL_INITIAL macro is set to width of bitfield and can be relied - on to check for bitfield ivars. Note that I cannot rely on - DECL_BIT_FIELD macro because it is only set when the whole struct - is seen (at finish_struct) and not when the ivar chain is - built. */ - if (DECL_INITIAL (field)) + if (DECL_C_BIT_FIELD (field)) return NULL_TREE; create_ivar_offset_name (var_offset_name, CLASS_NAME (class_name), field);