public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9381: stdcall attribute ignored in member function pointer type
@ 2003-01-21  4:56 drepper
  0 siblings, 0 replies; 2+ messages in thread
From: drepper @ 2003-01-21  4:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9381
>Category:       c++
>Synopsis:       stdcall attribute ignored in member function pointer type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 21 04:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Drepper
>Release:        gcc 3.2.1, current CVS trunk
>Organization:
>Environment:
x86/Linux
>Description:
The attached file is miscompiled since the stdcall attribute is ignored in the fp type definition.  The result it that in the function bar the parameters are popped from the stack even though they have already been removed by the called fucntion (f1 in this case).
>How-To-Repeat:
gcc -c e.cc -O2 -fomit-frame-pointer -mpreferred-stack-boundary=2
Look in the code generated for bar, there should be no popping for the pushed parameters.  In my case I get

  28:   ff 74 24 08             pushl  0x8(%esp,1)
  2c:   50                      push   %eax
  2d:   ff d2                   call   *%edx
  2f:   5a                      pop    %edx
  30:   59                      pop    %ecx
  31:   5b                      pop    %ebx
  32:   c3                      ret

The pop %ebx is OK (it's a saved register) but the other two pops are wrong.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="e.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="e.cc"

c3RydWN0IGZvbwp7CiAgaW50IGYxIChpbnQpIF9fYXR0cmlidXRlICgoc3RkY2FsbCkpOwp9Owp0
eXBlZGVmIGludCAoZm9vOjoqZnApIChpbnQpIF9fYXR0cmlidXRlICgoc3RkY2FsbCkpOwpmb28g
KmE7CmZwIHAgPSAmZm9vOjpmMTsKaW50CmJhciAoaW50IG4pCnsKICByZXR1cm4gKDo6YS0+KnAp
IChuKTsKfQppbnQgZm9vOjpmMSAoaW50IGEpIHsgcmV0dXJuIGEgKyAxMDsgfQo=


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

* Re: c++/9381: stdcall attribute ignored in member function pointer type
@ 2003-01-21 14:16 Christian Ehrhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Ehrhardt @ 2003-01-21 14:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/9381; it has been noted by GNATS.

From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de>
To: drepper@redhat.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/9381: stdcall attribute ignored in member function pointer type
Date: Tue, 21 Jan 2003 15:10:30 +0100

 On Tue, Jan 21, 2003 at 04:52:51AM -0000, drepper@redhat.com wrote:
 > The attached file is miscompiled since the stdcall attribute is ignored in the fp type definition.  The result it that in the function bar the parameters are popped from the stack even though they have already been removed by the called fucntion (f1 in this case).
 
 The answer to this non bug used to be: "The placement of your __attribute__
 is wrong". This should be the proper placement:
 
 typedef int (__attribute__ ((stdcall)) foo::*fp)(int);
 
 However, with the new parser this gives a parse error :-(
 The following gives a warning with 3.4 but works with all gcc versions, it
 is documented as an extension though:
 
 typedef int (foo::*__attribute__ ((stdcall)) fp) (int);
 
 I.e. this is not a bug in 3.2.1. It is a bug in the new parser in 3.4 though.
 
     regards  Christian
 
 -- 
 THAT'S ALL FOLKS!


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

end of thread, other threads:[~2003-01-21 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-21  4:56 c++/9381: stdcall attribute ignored in member function pointer type drepper
2003-01-21 14:16 Christian Ehrhardt

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