r338630 - [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl into DeclContext

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 6 07:00:18 PDT 2018


Hello,

This is the only occurence of such an enum in a SomethingDeclBitfields
introduced by this patch so it probably is the only instance of this bug.

I will quickly commit a patch moving the enum above as you suggest.
In the future I am not sure this enum will stay since as explained
in the comment it is only here to avoid including Basic/IdentifierTable.h...

Thanks for the report and sorry for the broken build!

Bruno Ricci

On 06/08/18 13:57, Keane, Erich wrote:
> Hi, sorry for the delayed response, I only just got back into the office.  I've added the author of the patch to this email chain.
> 
> -----Original Message-----
> From: Abramo Bagnara [mailto:abramo.bagnara at bugseng.com] 
> Sent: Sunday, August 5, 2018 5:03 AM
> To: Keane, Erich <erich.keane at intel.com>; cfe-commits at lists.llvm.org
> Subject: Re: r338630 - [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl into DeclContext
> 
> Il 01/08/2018 22:48, Erich Keane via cfe-commits ha scritto:
>> Author: erichkeane
>> Date: Wed Aug  1 13:48:16 2018
>> New Revision: 338630
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=338630&view=rev
>> Log:
>> [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl 
>> into DeclContext
>>
> 
> This commit break the build with gcc version 7.3-win32 20180312 (GCC).
> 
> I've tracked the cause to the presence of:
> 
> enum { ObjCMethodFamilyBitWidth = 4 };
> 
> between two bitfields declarations.
> 
> Moving it to begin of class fix the build. This is spotted only because the static_assert, so it is well possible there are other occurrences of the same problem.
> 
> The following typescript show the issue:
> 
> abramo at igor:/tmp$ cat bad.cc
> #include <cstdint>
> enum { NumDeclContextBits = 13 };
> class ObjCMethodDeclBitfields {
>   uint64_t : NumDeclContextBits;
>   enum { ObjCMethodFamilyBitWidth = 4 };
>   mutable uint64_t Family : ObjCMethodFamilyBitWidth;
>   uint64_t IsInstance : 1;
>   uint64_t IsVariadic : 1;
>   uint64_t IsPropertyAccessor : 1;
>   uint64_t IsDefined : 1;
>   uint64_t IsRedeclaration : 1;
>   mutable uint64_t HasRedeclaration : 1;
>   uint64_t DeclImplementation : 2;
>   uint64_t objcDeclQualifier : 7;
>   uint64_t RelatedResultType : 1;
>   uint64_t SelLocsKind : 2;
>   uint64_t IsOverriding : 1;
>   uint64_t HasSkippedBody : 1;
> };
> static_assert(sizeof(ObjCMethodDeclBitfields) <= 8,
>               "ObjCMethodDeclBitfields is larger than 8 bytes!"); abramo at igor:/tmp$ x86_64-w64-mingw32-g++ -c bad.cc
> bad.cc:20:1: error: static assertion failed: ObjCMethodDeclBitfields is larger than 8 bytes!
>  static_assert(sizeof(ObjCMethodDeclBitfields) <= 8,  ^~~~~~~~~~~~~
> 1|abramo at igor:/tmp$ cat good.cc
> #include <cstdint>
> enum { NumDeclContextBits = 13 };
> class ObjCMethodDeclBitfields {
>   enum { ObjCMethodFamilyBitWidth = 4 };
>   uint64_t : NumDeclContextBits;
>   mutable uint64_t Family : ObjCMethodFamilyBitWidth;
>   uint64_t IsInstance : 1;
>   uint64_t IsVariadic : 1;
>   uint64_t IsPropertyAccessor : 1;
>   uint64_t IsDefined : 1;
>   uint64_t IsRedeclaration : 1;
>   mutable uint64_t HasRedeclaration : 1;
>   uint64_t DeclImplementation : 2;
>   uint64_t objcDeclQualifier : 7;
>   uint64_t RelatedResultType : 1;
>   uint64_t SelLocsKind : 2;
>   uint64_t IsOverriding : 1;
>   uint64_t HasSkippedBody : 1;
> };
> static_assert(sizeof(ObjCMethodDeclBitfields) <= 8,
>               "ObjCMethodDeclBitfields is larger than 8 bytes!"); abramo at igor:/tmp$ x86_64-w64-mingw32-g++ -c good.cc abramo at igor:/tmp$
> 
> 
> --
> Abramo Bagnara
> 
> BUGSENG srl - http://bugseng.com
> mailto:abramo.bagnara at bugseng.com
> 


More information about the cfe-commits mailing list