[gcc r10-9530] Objective-C++ : Fix bitfield ivars regression.

Iain D Sandoe iains@gcc.gnu.org
Wed Mar 24 22:07:02 GMT 2021


https://gcc.gnu.org/g:67f06cb9625542e3f9ffab98e23e729c7ef157ad

commit r10-9530-g67f06cb9625542e3f9ffab98e23e729c7ef157ad
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Oct 10 11:14:47 2020 +0100

    Objective-C++ : Fix bitfield ivars regression.
    
    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++.
    
    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.
    
    (cherry picked from commit 73699d921d8734c351b9897f16a04453f6a47301)

Diff:
---
 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 cc5d025dc18..ceeca15f684 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -1407,12 +1407,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);


More information about the Gcc-cvs mailing list