Subject: Re: [PATCH v4 08/23] ewah: compressed bitmap implementation

From: Jonathan Nieder <[email-masked]>
Date: Thu, 23 Jan 2014 12:12:23 -0800

Jeff King wrote:
> On Thu, Jan 23, 2014 at 11:52:06AM -0800, Jonathan Nieder wrote:

>> My main worry about the patches is that they will probably run into
>> an analagous problem to the one that v1.7.12-rc0~1^2~2
[...]
> I think this probably works in practice because align_ntohl is inlined,
> and any sane compiler will never actually load the variable.

I don't think that's safe to rely on.  The example named above didn't
pose any problems except on one platform.  All the relevant functions
were static and easy to inline.  GCC just followed the standard
literally and chose to break by reading one word at a time, just like
in this case it could break e.g. by copying one word at a time in
__builtin_memcpy (which seems perfectly reasonable to me ---
optimization involves a lot of constraint solving, and if you can't
trust your constraints then there's not much you can do).