This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/13079] New: Function calls overwrite stack data


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]