This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13079] New: Function calls overwrite stack data
- From: "bmills at andrew dot cmu dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2003 21:44:20 -0000
- Subject: [Bug c/13079] New: Function calls overwrite stack data
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Function calls behave incorrectly in the presence of inline assembly;
specifically, they are not flagged as relying on the value of the stack pointer.
See the minimal test-case below for details.
Bryan Mills
========================
void foo(int bar)
{
}
int main()
{
int returnCode;
foo(-1); /* not broken */
asm volatile("pushl $0" : : : "esp"); /* put a 0 on the stack */
foo(-1); /* broken -- should not overwrite value just placed on stack */
asm volatile("popl %0" : "=r" (returnCode) : : "esp"); /* should be 0,
actually 1 */
exit(returnCode);
}
--
Summary: Function calls overwrite stack data
Product: gcc
Version: 3.2.1
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bmills at andrew dot cmu dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13079