Re: [PATCH] evaluate: sizeof(bool) could be larger than sizeof(char)

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

 



On Tue, Feb 19, 2019 at 02:54:23PM -0800, Josh Triplett wrote:
> On Mon, Feb 18, 2019 at 10:30:53PM +0100, Luc Van Oostenryck wrote:
> > The C standard doesn't require that the size of a _Bool is 1,
> > its size is implementation defined.
> > 
> > However, in evaluate_sizeof() the assumption is made that
> > a bool is the same size as a char.
> > 
> > Fix this wrong assumption by using the existing bits_in_bool.
> > 
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> 
> I seem to recall this going back and forth at some point in Sparse's
> history, and that there were multiple places that assumed the size of a
> bool, not just this. I don't remember the conclusion of that (or if
> there was one), though.

I only saw this one by accident but now I've searched about some
other cases and found nothing obvious. Not that it really matters
since in all case Sparse uses 'bits_in_bool = 1' (which creates
its own problem, for example when using a bitfield of a bool).

Best regards,
-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux