[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] 0-width named bitfield



Hi Paulo,

Nice catch. We intended to output 0-length field as anonymous, but the macro
" CSMITH_BITFIELD" makes it hard to determine whether a bitfield is 0 length
or not at generation time. We are working on a solution to remove the macro.

thanks,

-Xuejun

> -----Original Message-----
> From: csmith-dev-bounces@flux.utah.edu
> [mailto:csmith-dev-bounces@flux.utah.edu] On Behalf Of Paulo J. Matos
> Sent: Tuesday, August 16, 2011 4:30 AM
> To: csmith-dev@flux.utah.edu
> Subject: [csmith-dev] 0-width named bitfield
> 
> Hi,
> 
> As far as I know 0-width named bitfields are not allowed, but they are
> being generated by
>   * Generator: csmith 2.1.0
>   * Git version: 60de822
>   * Options:   --no-checksum --no-argc
>   * Seed:      662099352
> 
> struct S0 {
>     signed f0 : _CSMITH_BITFIELD(46);
>     unsigned f1 : _CSMITH_BITFIELD(26);
>     signed f2 : _CSMITH_BITFIELD(12);
>     signed f3 : _CSMITH_BITFIELD(16);
>     const signed f4 : _CSMITH_BITFIELD(26);
>     volatile signed f5 : _CSMITH_BITFIELD(32);
>     volatile unsigned f6 : _CSMITH_BITFIELD(62);
> };
> 
> f5 is a zero width bitfield. After preprocessing:
>     volatile signed f5 :
> (((32)>(sizeof(int)*16))?((32)%(sizeof(int)*16)):(32));
> 
> sizeof(int) for our arch is 1.
> 
> Cheers,
> --
> Paulo Matos
> 
> 
> Member of the CSR plc group of companies. CSR plc registered in England
and
> Wales, registered number 4187346, registered office Churchill House,
> Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Follow CSR on Twitter at
> http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog