[Bug c++/53005] New: 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.

2012-04-16 Thread zhao86.scholar at gmail dot com
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


[Bug c/53005] 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.

2012-04-16 Thread zhao86.scholar at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53005

--- Comment #2 from Lili Zhao  2012-04-16 
10:17:43 UTC ---
Do you mean we should use a later GCC version?
(In reply to comment #1)
> GCC 4.2 is not supported, please try a current release.


[Bug c/53005] 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.

2012-04-16 Thread zhao86.scholar at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53005

--- Comment #6 from Lili Zhao  2012-04-17 
02:43:31 UTC ---
Thanks all the same! I'll try on the latest gcc version to see if the bug
reproduce. Thank you!

2012/4/16 manu at gcc dot gnu.org 

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53005
>
> --- Comment #5 from Manuel López-Ibáñez 
> 2012-04-16 11:18:51 UTC ---
> Lili Zhao, I forgot to say, but feel free to reopen this if you can
> reproduce
> the bug with GCC 4.7. Thanks for the report anyway, and sorry we cannot
> help
> you.
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> --- You are receiving this mail because: ---
> You are on the CC list for the bug.
> You reported the bug.
>