[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: Branko Čibej <brane_at_e-reka.si>
Date: Sat, 05 Mar 2011 22:21:12 +0100

On 05.03.2011 19:52, Stefan Fuhrmann wrote:
> 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);

Oh I see, you're doing pointer/offset fixups in shared memory. Yah.
Have you considered using a union { const char*, size_t } instead of a
pointer? That /should/ be safe even with strict aliasing, as long as you
always read the union member that you last wrote (which should work fine
given what you're doing). This way you avoid all the casts, too.

> I would consider that a bug

... but it's not, given strict-aliasing semantics ...

-- Brane
Received on 2011-03-05 22:21:51 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.