On 05.03.2011 11:55, Branko Čibej wrote:
On 05.03.2011 11:34, Stefan Fuhrmann wrote:
I suspect that -fstrict-aliasing (or something similar)
might have broken svn_temp_deserializer__resolve().
r1078256 tries to circumvent that.
Ahem. Type casting will not help, at least GCC's optimizer sees right
through them.
Well, my hypothesis is that the optimizer breaks the
code *due to* the casting:
*(const char**)ptr = buffer + (size_t)*ptr;
assert(*ptr > buffer);
might become:
temp1 = *ptr;
*ptr = buffer + temp1;
assert(temp1 > buffer);
I would consider that a bug but I rearranged the code
such that it should produce the desired result even
in the presence of these issues:
const char *target = buffer + *(size_t*)ptr1;
assert(target > buffer); // this is the key
*(const char**)ptr = target;
The thing to do is to not play silly buggers with type
punning in the first place. :)
Sometimes you have to. But one should strive to
limit these instances.
-- Stefan^2.