On 2016-09-26 Carroll, Michael R wrote:
> *In essence, our change is twofold:
> 1) typedef lzma_coder as a void. Parent data structures (struct
> lzma_next_coder_s and struct lzma_internal_s) refer to a void pointer
> and are in line with c99 6.2.7 as caller and callee will see the same
> definition:
[...]
> 2) Refer to the lzma_coder data structure members with an assignment
> from the void pointer like so:

Years ago I knew it wasn't really the correct thing to do, but as you
noticed, it avoided the need for extra variable in many functions to
handle the void* <-> lzma_coder* cast. Each translation unit has exactly
one definition for lzma_coder and so it worked fine, but I guess newer
things like link-time optimization that see beyond one translation unit
make this trick unusable.

In other words, the code was too clever and now it causes problems. I
will fix it. Thanks.

Speaking of standards conformance, another possible issue might be in
src/common/tuklib_integer.h which does things like this:

    uint32_t num = *(const uint32_t *)buf;

GCC doesn't give strict aliasing warnings about those, but my limited
understanding is that the lack of warnings doesn't mean that there
aren't any aliasing issues.

src/liblzma/common/memcmplen.h is another place where similar casts are
done. It's a new file in 5.2.x (not present in 5.0.x) and was added to
get a bit better performance for common buffer comparisons.

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

Reply via email to