On Wed, 2017-01-04 at 10:39 -0500, Andrew Stitcher wrote:
> On Wed, 2017-01-04 at 14:47 +0000, Adel Boutros wrote:
> > I found the issue!!
> > 
> > 
> > It is a Solaris compiler bug:
> > 
> > Actually Solaris doesn't handle correctly bit fields in C. This is
> > the case of the struct pn_collector_t (bool head_returned:1).
> 

Huh? What?? Bitfields have been a standard part of C since forever. I
am astonished.

> We probably should just never be using bifields in this case - it is
> pretty unusual in my experience (even if it seems like it would save
> space in the struct).
> 

They're not used often because people tend to be too busy to think
about struct packing, but they are an important perf tuning tool. It
can be the difference between a single bool packing into 1 bit at best 
vs 64 at worst. That can easily double the size of a small structure
that gets allocated by the millions, or force cache misses on the
critical path. It often is not very important but sometimes it really
is.

> So I, for one, would definitely accept a patch to remove all uses of
> bool bitfields.

If existing bit fields can be removed without performance impact to fix
a bug then I'm OK with that too, but a blanket ban on bit fields seems
unreasonable. Can we narrow the scope of the actual Solaris problem to
something smaller than "bitfields are broken, don't ever use them"? I'm
pretty sure that can't be the case.

Cheers,
Alan.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to