------- Comment #4 from agner at agner dot org 2006-05-11 07:11 ------- Thanks for confirming this bug. If Gcc relies on the stack being aligned then it has to be an official ABI requirement.
It makes perfectly sense to compile the whole program, or some of it, with -Os and also use XMM. -Os can be the optimal option if code cache or data cache is a critical resource. It is also a perfectly justifiable solution to compile the part of the program that contains the innermost loop with -O3 and the rest of the program with -Os. The error also occurs if part of the program is compiled with the Intel C++ compiler, because the Intel people follow the official ABI which hasn't been updated for many years. The Intel compiler is intended to be 100% binary compatible with Gnu. Gcc is no longer a hobby project for a limited group of nerds. It is one of the most used compilers in the world and it is used for critical applications. Therefore, you have to be strict about ABI standards. Either the ABI must be changed and made public, or the compiler must be changed so that it doesn't rely on the stack being aligned by 16. I can find the "SYSTEM V. APPLICATION BINARY INTERFACE. Intel386 Architecture Processor Supplement" at www.caldera.com. It says "DRAFT COPY, March 19, 1997". Nothing indicates that this is the official or the latest version. It says nothing about MMX or XMM. I have documented the things that are not clear from the ABI in http://www.agner.org/assem/calling_conventions.pdf as good as I can. I am going to change this document when this issue is resolved. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27537