public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31628]  New: stdcall function is miscompiled
@ 2007-04-18 18:44 marcus at jet dot franken dot de
  2007-04-18 18:44 ` [Bug c/31628] " marcus at jet dot franken dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marcus at jet dot franken dot de @ 2007-04-18 18:44 UTC (permalink / raw)
  To: gcc-bugs

Testcase is extracted from Wine.

/home/marcus/projects/gcc/BIN/bin/gcc -m32 -fPIC   -O2  -o reg reg.i
./reg
Segmentation fault
(I did not try the i586 version of the compiler.)


Looking at the disassembly the stdcall function is compiled as:
foo:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        call    __i686.get_pc_thunk.bx
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        subl    $4, %esp
        movl    $0, (%esp)
        call    bar@PLT
        addl    $4, %esp
        popl    %ebx
        popl    %ebp
        ret

It does adjust the stackframe after the call to bar wrongly, either it should
not do it, or just emit a "leave".


-- 
           Summary: stdcall function is miscompiled
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marcus at jet dot franken dot de
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: i586-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31628


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-05-26  3:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
2007-04-18 18:44 ` [Bug c/31628] " marcus at jet dot franken dot de
2007-04-18 18:46 ` marcus at jet dot franken dot de
2007-04-18 18:46 ` marcus at jet dot franken dot de
2007-04-18 19:16 ` [Bug target/31628] " rguenth at gcc dot gnu dot org
2007-04-18 21:14 ` rth at gcc dot gnu dot org
2007-04-20 23:54 ` rth at gcc dot gnu dot org
2007-04-20 23:58 ` rth at gcc dot gnu dot org
2007-05-18 19:30 ` hjl at gcc dot gnu dot org
2007-05-26  3:10 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).