Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" To: "'Cygwin List'" Subject: RE: gcc bug: convert_move -O3 Date: Thu, 30 Jun 2005 13:05:14 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit In-Reply-To: <42C3D30D.4060302@familiehaase.de> Message-ID: ----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/