This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: gcc bug: convert_move -O3
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Cygwin List'" <cygwin at cygwin dot com>
- Date: Thu, 30 Jun 2005 13:05:14 +0100
- Subject: RE: gcc bug: convert_move -O3
----Original Message----
>From: Gerrit P. Haase
>Sent: 30 June 2005 12:10
> Reini Urban wrote:
>> oops.
>>> static int hack30_pray(ax, items, func)
>>> int ax;
>>> int items;
>>> void *func;
>>> {
>>> return 0;
>>> }
>>> int main () {
>>> int ax, items;
>>> void * symref;
>>> float num;
>>> num = ((*((float (*)()) hack30_pray))(ax,items,symref)); return 0;
>>> }
> S.th. wrong with your testcase?
Absolutely. There are two *VERY* bad things about that bit of code:
1) The function call is through a pointer-to-function-returning float, but
the function itself returns a void *. This is likely to screw up the x87 FP
stack when the caller pops a return value that the callee didn't push.
2) Also, the function call is through a pointer-to-function-taking-stdargs,
but the function itself is not a stdargs function. Given the wrong calling
conventions, this is liable to lead to both caller *and* callee cleaning the
args off the stack.....
A name like 'hack*_pray' suggests that this is an ugly hack that the
author was praying was going to work..... I am obliged to agree!
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/