From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30121 invoked by alias); 18 Apr 2007 18:44:26 -0000 Received: (qmail 30092 invoked by uid 48); 18 Apr 2007 18:44:18 -0000 Date: Wed, 18 Apr 2007 18:44:00 -0000 Subject: [Bug c/31628] New: stdcall function is miscompiled X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "marcus at jet dot franken dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg01414.txt.bz2 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