<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Török Edwin wrote:
<blockquote cite="mid:4B01C34B.7000507@gmail.com" type="cite">
<pre wrap="">On 2009-11-16 22:46, John Criswell wrote:
</pre>
<blockquote type="cite">
<pre wrap="">[snip]
</pre>
<blockquote type="cite">
<pre wrap="">My initial message (containing the patch) was a private reply to John.
Attached the patch again, it applies with 'patch -p0'.
Also try to build on x86-32, x86-64 is not quite ready yet.
</pre>
</blockquote>
<pre wrap="">Actually, I made one small change to the patch. I kept -Werror in
Makefile.common.in. It's better if we fix these warnings; -Werror
provides incentive for that.
I'll consider removing it if there's a problem that's not trivially
fixable.
</pre>
</blockquote>
<pre wrap=""><!---->
That leaves us with the aliasing violations. I looked at the first, and
I couldn't tell why gcc (4.3.4) thinks it is wrong:
safecode/runtime/BitmapPoolAllocator/PoolAllocatorBitMask.cpp:185:
warning: dereferencing type-punned pointer will break strict-aliasing rules
Line 185 is: PS->addToList((PoolSlab**)&Pool->Ptr2);
and Ptr2 is a field of type void*. Isn't void* compatible with anything?
</pre>
</blockquote>
<br>
No. void* is _convertible_ to an arbitrary pointer type (6.3.2.3p1):<br>
<br>
A pointer to void may be converted to or from a pointer to any
incomplete or object type. A pointer to any incomplete or object type
may be converted to a pointer to void and back again; the result shall
compare equal to the original pointer.<br>
<br>
But the _compatibility_ rules for pointers don't mention void*
(6.7.5.1p2):<br>
<br>
For two pointer types to be compatible, both shall be identically
qualified and both shall be pointers to compatible types.<br>
<br>
Nor is there an exception carved out in 6.5p1.<br>
<br>
Among other things, this permits null pointers to have different
representations based on the element type, &c &c.<br>
<br>
John.
</body>
</html>