[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3755) OpenLDAP breaks strict aliasing rules

I've been looking a bit more at this.  Except for the (BerElement *)
casts, most of the "strict aliasing" warnings I examined actually refer
to casts that are buggy regardless of aliasing rules.  Typically they
cause a value to be accessed through the wrong type.

I've noticed a few real bugs (fixing or ITSing those), but mostly they
drown in the warnings from things like (void**)&struct_foo_pointer which
is later dereferenced without casting it back to struct foo**.  That
breaks if some pointer types have different representation.  slapi is
doing a *lot* of that, the sl_malloc code mentioned before is another

Oh, and please ignore my suggestion to replace (BerElement *)&berbuf
with (BerElement *)berbuf.buffer for now.  I suspect that actually
changes almost-correct code til worse code, except when compiled with
gcc:-(  char is magical for aliasing rules, but not that magical.