[Spice-devel] [RFC] codegen+demarshal: cast to void** through a temporary
Alon Levy
alevy at redhat.com
Tue Aug 17 09:06:10 PDT 2010
----- "Alexander Larsson" <alexl at redhat.com> wrote:
> On Thu, 2010-07-29 at 12:20 -0400, Alon Levy wrote:
> > Changes
> > var = (void**)&val;
> > Into
> > {
> > typeof val* p = &val;
> > var = (void**)p;
> > }
> >
> > Which fixes these warnings (we compile with -Werror, any warning
> breaks compile):
> > warning: dereferencing type-punned pointer will break
> strict-aliasing rules
>
> This is too ugly to live. I wonder why I don't get the warning with
> gcc
> 4.4.x though. Maybe its smarter?
>
:) I agree. I sent it to the list so anyone who wants to compile for the
n900 can. I can try the char* you suggested and see if it works.
> Anyway, we could either do -Wno-strict-aliasing and assume we won't
> run
> into actual problems from this, or we could try another workaround.
> The
> C standard says that "char *" pointers may alias stuff, so maybe we
> can
> get around things by casting via char *, or by storing the void ** as
> char *.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Alexander Larsson Red Hat,
> Inc
> alexl at redhat.com alexander.larsson at gmail.com
> He's a short-sighted neurotic firefighter fleeing from a secret
> government
> programme. She's a mistrustful insomniac vampire living on borrowed
> time. They
> fight crime!
More information about the Spice-devel
mailing list