delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/06/30/08:08:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: "'Cygwin List'" <cygwin AT cygwin DOT com>
Subject: RE: gcc bug: convert_move -O3
Date: Thu, 30 Jun 2005 13:05:14 +0100
MIME-Version: 1.0
In-Reply-To: <42C3D30D.4060302@familiehaase.de>
Message-ID: <SERRANO689cMhtTYDGG000002d2@SERRANO.CAM.ARTIMI.COM>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019