http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53005
Bug #: 53005 Summary: GCC moves the called C function address and parameters to the wrong stack position, when making C-style calling of C functions in a C function with inline assembly code. Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: zhao86.scho...@gmail.com Created attachment 27167 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27167 C code to reproduce the bug. When making C-style calling of C functions in a C function with inline assembly code, GCC moves the called C function address and parameters to the wrong stack position, which is overwriting the values of other variables in the stack. The problem can be reproduced using the C code in the attached. The exact version of GCC: 4.2.1 The system type: i686-apple-darwin11 The options given when GCC was configured/built: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1