[Bug target/91779] Unbalanced stack manipulation

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Sep 17 21:21:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91779

--- Comment #10 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Andreas Schwab from comment #9)
> Created attachment 46893 [details]
> libfi.so.7

This attached library has exactly the same problem.

Put a breakpoint at:

   0x08049265 <+341>:   pushl  -0x60(%ebp)
*  0x08049268 <+344>:   call   *-0x54(%ebp)
   0x0804926b <+347>:   movzbl -0x59(%ebp),%eax

then:

Breakpoint 1, 0x08049268 in main ()
(gdb) p $sp
$1 = (void *) 0xffffce60
(gdb) ni
Char f(Char,double,Char):({'A'},0.2,{'C'})->{'B'}
0x0804926b in main ()
(gdb) p $sp
$2 = (void *) 0xffffce80

The called STDCALL function should adjust stack by 0x14 here, this is what
compiler claims:

(call_insn 115 114 116 7 (parallel [
            (call (mem:QI (mem/f/c:SI (plus:SI (reg/f:SI 6 bp)
                            (const_int -84 [0xffffffffffffffac])) [23
callback_code+0 S4 A32]) [0 *callback_code.865_10 S1 A8])
                (const_int 32 [0x20]))
            (set (reg/f:SI 7 sp)
                (plus:SI (reg/f:SI 7 sp)
                    (const_int 20 [0x14])))
        ]) "../../testsuite/libffi.bhaible/test-callback.c":2325:13 673
{*call_pop}
     (expr_list:REG_ARGS_SIZE (const_int 12 [0xc])
        (expr_list:REG_CALL_DECL (nil)
            (nil)))
    (nil))


More information about the Gcc-bugs mailing list