This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Aliasing bug
On Thu, Jul 2, 2009 at 3:29 PM, Andrew Stubbs<ams@codesourcery.com> wrote:
> On 02/07/09 14:26, Richard Guenther wrote:
>>
>> You are writing to memory of type void * via an lvalue of type short *.
>
> Yes, there is type punning there, but that should work, shouldn't it?
No, that's invalid. You would have to do
extern union {
void *foo;
short *bar;
};
using the union for the double-indirect pointer doesn't help. Or
simply use memcpy to store to foo.
Richard.