[Zlib-devel] HEADS UP: Apparent bad compilation under (just released) GCC 4.5.0
Jesus Cea
jcea at jcea.es
Tue May 11 17:28:26 EDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/05/10 23:13, Török Edwin wrote:
>> I was wondering if the testsuite in ZLIB should missalign stack on
>> purpose (stack aligned to 4 bytes but not to 16 bytes) to catch&burn
>> this issue as early as possible.
>
> How do you know if the platform guarantees 16-byte alignment or not?
> I tried to follow that discussion on bugzilla, and lost track who is
> right, who is wrong and which ABI applies in this case on Linux.
In x86 world, the CPU requires 4 byte alignment, except for SSE/MMX
code, that the requirement is 16 byte alignment.
But yes, ZLIB is CPU agnostic, so trying to protect GCC from itself is
not ZLIB role at all.
> GCC could have inserted some code to check its assumptions, or at least
> have such a flag for debugging. I think I'll file such a bugzilla request.
That is the point of the bugzilla discussion and the reason that adding
the stack alignment flag does the trick.
> Maybe there is a ABI/C standard that allows them to do these
> assumptions/optimizations, but breaking programs on purpose is certainly
> not a useful optimization.
The bugzilla discussion is very enlightment. Basically GCC developers
expect stack 16 byte aligned, but that is not required by the ABI, so
they are crashing programs around. The point of one of the posters there
is "please, stop creating your own unofficial ABI" :-).
So anyway, this is a big mess, but not related to ZLIB.
I guess I will start seeing more code crashing under python+psyco when I
begin to compile new version of libraries with GCC 4.5.0. It is good to
know...
PS: The role of psyco here, I guess, is that it is a JIT and generated
code doesn't align stack to 16 byte (it is legal to do it!), but new GCC
compiled code doesn't like it.
- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/_/_/_/
. _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQCVAwUBS+nL+Zlgi5GaxT1NAQKZrgP/cHGBDNTuedWo0Px1UAF+w3FtEZEAk91O
n27IFKOP0GQJIpK7Efg2Nie4oBd/SJY5sLE3lHH62FaBNIyQ1BxxaXX8d9IibJBB
rH0MjusLtu5T8MlY+jY774OOAgRGAZm68nIi3r3tlGutA1L/mk0ijd0GgOuIMgLU
U+XJ3lDKuDc=
=pmgV
-----END PGP SIGNATURE-----
More information about the Zlib-devel
mailing list