[cfe-dev] Using a enum type for a bitfield

Michael Hordijk via cfe-dev cfe-dev at lists.llvm.org
Thu Sep 3 09:05:29 PDT 2015


Yes, that's a good summary.  bug 11272 is the request for this type of 
documentation.  In general I think more people will be looking for this 
type of documentation such that the can determine how using this 
implementation will effect them.

In the near term we need a direct answer as to whether clang supports 
implementation defined behavior under C11 6.7.2.1 P 5, specifically the 
use of enums as bit fields.

We're starting to run into some issues that are indicating that it may 
not be supported, which is fine but we need to know the intentions for 
this behavior.

I suppose that technically if the implementation does not define the 
behavior then the behavior is not supported/undefined.  If it's going to 
be supported we'd like to avoid unnecessary code churn.  On the flip 
side we could just go remove this behavior and we won't have to worry 
about it if we decide to use a different implementation.

- michael

On 8/26/15 4:38, mats petersson via cfe-dev wrote:
> @Serge:
>
> I think the point of bug 11272 is to actually document [directly or
> referring to some other documentation elsewhere] ALL of the clang
> implementation defined behaviour, which includes the behaviour with
> bitfields from enums (and I expect it is identical to gcc's behaviour,
> but I don't KNOW that this is the case).
>
> --
> Mats
>
> On 26 August 2015 at 11:27, Serge Pavlov
> <sepavloff at gmail.com
> <mailto:sepavloff at gmail.com>> wrote:
>
>     Hi,
>
>     Bug 11272 - document implementation-defined behavior
>     <https://llvm.org/bugs/show_bug.cgi?id=11272> says nothing about bit
>     fields.
>
>     Thanks,
>     --Serge
>
>     2015-08-26 15:28 GMT+06:00 mats petersson via cfe-dev
>     <cfe-dev at lists.llvm.org
>     <mailto:cfe-dev at lists.llvm.org>>:
>
>         Bug number would be 11272 - the text has been mime-encoded to
>         replace the = with =3D (since mime uses = as a special
>         character, and =3D is the escaped = sign). Obviously, some step
>         on the way didn't understand the encoding and left it as plain
>         text without decoding it.
>
>         --
>         Mats
>
>         On 26 August 2015 at 08:29, Csaba Raduly via cfe-dev
>         <cfe-dev at lists.llvm.org
>         <mailto:cfe-dev at lists.llvm.org>> wrote:
>
>             Hi.
>
>             On Mon, Aug 24, 2015 at 10:29 PM, Hordijk, Michael via
>             cfe-dev  wrote:
>             > The short question:
>             >
>             > Does clang support using an enum as a type for a bit-field?
>             >
>             > C11 (6.7.2.1 P 5):
>             >
>             > A bit-field shall have a type that is a qualified or unqualified version
>             > of _Bool, signed int, unsigned int, or some other implementation-defined
>             > type.
>             ...
>             > So I'm curious as to whether clang supports it.  I did find this on
>             > bugzilla:
>             >
>             >https://llvm.org/bugs/show_bug.cgi?id=3D11272
>
>             LLVM Bugzilla says:
>
>             '3D11272' is not a valid bug number.
>
>
>             Csaba
>             --
>             GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
>             The Tao of math: The numbers you can count are not the real
>             numbers.
>             Life is complex, with real and imaginary parts.
>             "Ok, it boots. Which means it must be bug-free and perfect.
>             " -- Linus Torvalds
>             "People disagree with me. I just ignore them." -- Linus Torvalds
>             _______________________________________________
>             cfe-dev mailing list
>             cfe-dev at lists.llvm.org
>             <mailto:cfe-dev at lists.llvm.org>
>             http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
>         _______________________________________________
>         cfe-dev mailing list
>         cfe-dev at lists.llvm.org
>         <mailto:cfe-dev at lists.llvm.org>
>         http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>





More information about the cfe-dev mailing list