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



------- Comment #1 from marcus at jet dot franken dot de  2007-04-18 19:44 -------
Created an attachment (id=13389)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13389&action=view)
reg.i

gcc -fPIC -O2 -m32 reg.i


-- 


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


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

* [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

* [Bug c/31628] stdcall function is miscompiled
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcus at jet dot franken dot de @ 2007-04-18 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from marcus at jet dot franken dot de  2007-04-18 19:46 -------
the interesting part is that the declaration is just slightly incompatible
with the actual definition. If I remove the prototype the problem goes away.


-- 


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


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

* [Bug c/31628] stdcall function is miscompiled
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marcus at jet dot franken dot de @ 2007-04-18 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from marcus at jet dot franken dot de  2007-04-18 19:45 -------
i bisected gcc to find the regression and it was apparently introduced by
revision 123146.

2007-03-22  Richard Henderson  <rth@redhat.com>

       * config/i386/i386.c (ix86_function_regparm): Early exit for 64-bit;
       don't increase local_regparm with force_align_arg_pointer check.
       (ix86_function_sseregparm): Assert 32-bit.
       (type_has_variadic_args_p): New.
[...]


-- 


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (2 preceding siblings ...)
  2007-04-18 18:46 ` marcus at jet dot franken dot de
@ 2007-04-18 19:16 ` rguenth at gcc dot gnu dot org
  2007-04-18 21:14 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-04-18 19:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-04-18 20:16 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org,
                   |                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-18 20:16:43
               date|                            |


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2007-04-18 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rth at gcc dot gnu dot org  2007-04-18 22:14 -------
Reproducing the problem requires -maccumulate-outgoing-args,
as implied by i686 tuning.


-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   GCC host triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|i586-unknown-linux-gnu      |i686-*
   Last reconfirmed|2007-04-18 20:16:43         |2007-04-18 22:14:05
               date|                            |


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2007-04-20 23:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rth at gcc dot gnu dot org  2007-04-21 00:53 -------
Subject: Bug 31628

Author: rth
Date: Sat Apr 21 00:53:37 2007
New Revision: 124014

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124014
Log:
        PR target/31628
        * config/i386/i386.c (type_has_variadic_args_p): Look for any
        TREE_LIST with a void_type_node value, not void_list_node exactly.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c


-- 


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2007-04-20 23:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rth at gcc dot gnu dot org  2007-04-21 00:58 -------
Fixed.


-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at gcc dot gnu dot org @ 2007-05-18 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl at gcc dot gnu dot org  2007-05-18 20:30 -------
Subject: Bug 31628

Author: hjl
Date: Fri May 18 19:29:45 2007
New Revision: 124831

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124831
Log:
2007-05-18  H.J. Lu  <hongjiu.lu@intel.com>

        PR target/31628
        * gcc.target/i386/pr31628.c: New.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr31628.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/31628] stdcall function is miscompiled
  2007-04-18 18:44 [Bug c/31628] New: stdcall function is miscompiled marcus at jet dot franken dot de
                   ` (7 preceding siblings ...)
  2007-05-18 19:30 ` hjl at gcc dot gnu dot org
@ 2007-05-26  3:10 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-26  3:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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).