[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Breakage on trunk?

From: Stefan Fuhrmann <eqfox_at_web.de>
Date: Sat, 05 Mar 2011 19:52:52 +0100

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.
Received on 2011-03-05 19:53:23 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.