c++/9381: stdcall attribute ignored in member function pointer type

drepper@redhat.com drepper@redhat.com
Tue Jan 21 05:00:00 GMT 2003


>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=



More information about the Gcc-bugs mailing list