Hi All,

Support for long long bitfields was first implemented in SunStudio12. 
Please see 6484753, 6496021 CR`s.

Alexey.

[EMAIL PROTECTED] wrote:
>
> ---------- Forwarded message ----------
> Date: Thu, 11 Oct 2007 21:43:59 +1000
> From: James C. McPherson <[EMAIL PROTECTED]>
> To: Xiu-Yan Wang <[EMAIL PROTECTED]>
> Cc: tools-discuss@opensolaris.org, Cathy Thomas 
> <[EMAIL PROTECTED]>,
>     Ray Han <[EMAIL PROTECTED]>
> Subject: Re: [tools-discuss] Question on bit-field definitions under cc
>
> Xiu-Yan Wang wrote:
>> Hi all,
>>
>> When using cc bundled in SUNWspro to compile codes with bit-field
>> definitions like the following:
>>
>> typedef struct test_bitfield_s {
>>          uint64_t
>>                  field0 : 8,
>>                  field1 : 8,
>>                  field2 : 8,
>>                  field3 : 8,
>>                  field4 : 8,
>>                  field5 : 8,
>>                  field6 : 8,
>>                  field7 : 8,
>> }test_bitfield_t;
>>
>> I got the below error messages:
>>
>> "../include/message.h", line 48: invalid type for bit-field: field0
>> "../include/message.h", line 49: invalid type for bit-field: field1
>> "../include/message.h", line 50: invalid type for bit-field: field2
>> "../include/message.h", line 51: invalid type for bit-field: field3
>> "../include/message.h", line 52: invalid type for bit-field: field4
>> "../include/message.h", line 53: invalid type for bit-field: field5
>> "../include/message.h", line 54: invalid type for bit-field: field6
>> "../include/message.h", line 55: invalid type for bit-field: field7
>>
>> The error messages would disappear if uint64_t was replaced with
>> uint8_t, uint16_t, or uint32_t. So it seems that for cc contained in
>> SUNWspro 64-bit type can not be used in bit-field definitions. Could
>> someone familiar with the compiler confirm this or correct me if I'm
>> wrong?
>>
>> BTW, gcc allows 64-bit type to be used in bit-field definitions.
>
>
> This code compiles fine with Studio 12::
>
> ===============================================
> #include <sys/types.h>
> #include <stdlib.h>
>
> typedef struct test_bitfield_s {
>           uint64_t
>                   field0 : 8,
>                   field1 : 8,
>                   field2 : 8,
>                   field3 : 8,
>                   field4 : 8,
>                   field5 : 8,
>                   field6 : 8,
>                   field7 : 8;
> } test_bitfield_t;
>
> int
> main(int argc, char **argv) {
>          exit(0);
> }
>
> ===============================================
>
>
>
> But with Studio 11 from /ws/onnv-tools, I get
> the same error messages that you do
>
>
> $ /opt/SUNWspro/bin/cc -V
> cc: Sun C 5.9 SunOS_i386 2007/05/03
>
> $ /ws/onnv-tools/SUNWspro/SS11/bin/cc -V
> cc: Sun C 5.8 Patch 121016-05 2007/01/10
> usage: cc [ options] files.  Use 'cc -flags' for details
>
>
> I think you've found a bug in the compilers.
>
> I've logged
>
>
> 6615708 Studio11 doesn't grok uint64_t bitfields
>
>
> and included you on the interest list.
>
>
> James C. McPherson
> -- 
> Senior Kernel Software Engineer, Solaris
> Sun Microsystems
> _______________________________________________
> tools-discuss mailing list
> tools-discuss@opensolaris.org

_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org

Reply via email to