gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] strict aliasing


From: Gabriel Dos Reis
Subject: Re: [Gcl-devel] strict aliasing
Date: Sat, 12 Dec 2009 20:26:16 -0600

On Fri, Dec 11, 2009 at 3:19 PM, Camm Maguire <address@hidden> wrote:
> Greetings!
>
> Leo Butler <address@hidden> writes:
>
>> On Fri, 11 Dec 2009, Camm Maguire wrote:
>>
>> < Greetings! OK just fixd the GCL bugs, which result in some of the
>> < maxima bugs, and am ready for upload.
>> <
>> < There are new gcc warnings, which I always like to clear up.  Perhaps
>> < you might help by figuring out the currently blessed way of writing
>> < the following:
>> <
>> < #define GET_FAULT_ADDR(sig,code,sv,a) \
>> <     ((void *)(((struct sigcontext *)(&code))->cr2))
>> < #endif
>> <
>> < sgbc.c: In function 'memprotect_handler':
>> < sgbc.c:1620: warning: dereferencing pointer 'code.636' does break 
>> strict-aliasing rules
>> < sgbc.c:1620: note: initialized from here
>>
>> Camm, if I understand strict-aliasing [*] then the problem is that your 
>> macro is casting a
>> (void *) while on line 1620, faddr is a (char *).
>>
>> If you change your macro to cast a (char *), then this should fix this 
>> problem. Again,
>> from the above article, (char *) may refer to an alias of any object, so 
>> this should
>> not introduce any additional breakages of the strict aliasing rules.

There is no issue with aliasing if you access a memory storage as
'char *' -- the C sandard explicitly says it is OK.

-- Gaby




reply via email to

[Prev in Thread] Current Thread [Next in Thread]