freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Bug on PowerPC: Illegal Intruction in FT_Get_Name_Index (


From: Behdad Esfahbod
Subject: Re: [ft-devel] Bug on PowerPC: Illegal Intruction in FT_Get_Name_Index (worksforme)
Date: Sun, 22 May 2005 21:33:16 -0400 (EDT)

On Mon, 9 May 2005, Werner LEMBERG wrote:

> Behdad,
>
> your patches fail if g++ is used for compiling FreeType 2.  Can you
> fix this?  And please provide a ChangeLog entry.

Ok, the attached patch should fix it all.  Here is the summary:

Say you have (Foo*)x and want to assign it / pass it / return it
as (Bar*).  If you simply say "x" or "(Bar*)x", then the C
compiler would warn you that type casting incompatible pointer
types breaks strict-aliasing.  The solution is to cast to (void*)
instead which is the generic pointer type, so the compiler knows
that it should make no strict-aliasing assumption on x.  But the
problem with "(void*)x" is that seems like in C++, unlike C,
void* is not a generic pointer type and assigning void* to Bar*
without a cast causes an error.  The solution is to cast to
Bar* too.  The whole thing would be "(Bar*)(void*)x", which is
what the attached patch does.  The patch fixes a couple other
problems too.

BTW, seems like authogen.sh and configure scripts in the CVS lack
the executable flag.  I'm not sure whether it's possible to fix
it without removing the files and adding again, assuming no
access to the server.

One more thing:  I found it very hard to reconfigure freetype2 on
Unix, to use another compiler for example.  When I rerun
./configure with another CFLAGS, I see it report the new
compiler, but when making, it's still using the old one.  My
humble solution was checking out a fresh copy...

>     Werner

--behdad
http://behdad.org/

Attachment: freetype2-strictaliasing.patch
Description: Text document


reply via email to

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