[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] strict aliasing
From: |
Werner LEMBERG |
Subject: |
Re: [ft-devel] strict aliasing |
Date: |
Wed, 11 Nov 2015 08:42:29 +0100 (CET) |
> Compilers are beginning to embrace more aggressive optimization
> techniques. One of these directions is that of strict aliasing. We
> have experienced crashes on some ARM embedded devices in some code
> that was flagged with the “strict aliasing” warning. We have been
> going through our code, changing casts to unions in appropriate
> ways, and have sidestepped the crashes.
>
> However, Freetype is a bit of a problem, since it is open source.
Soo... Do you get crashes in FreeType?
> Are you planning to make a pass over the Freetype code base to
> eradicate these strict aliases?
Well, yes, but I don't consider it urgent. Main reason for (most of)
the warnings is FreeType's attempt to simulate C++ classes with plain
C. As far as I know, we don't try to be overly clever besides
this :-)
My preferred solution would be to use something similar to the fix in
issue #27441, given that unions is not the right way to go for C++,
according to advice I've seen in the internet – and I want to preserve
the ability that a C++ compiler can compile FreeType.
http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=82633a2440d48ed22a1f70062d8926c37f9dcf31
[Note that for some unknown reasons this link doesn't work for me;
maybe a Savannah bug – however, you can clone the FreeType repository
to view the related code.]
Do you want to help here?
Werner