delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/28/13:50:59

X-Spam-Check-By: sourceware.org
Message-ID: <BAY108-F1010AD059413E67F455A7DBE090@phx.gbl>
X-Sender: marchywka AT hotmail DOT com
In-Reply-To: <006a01c7b9ab$418ca130$2e08a8c0@CAM.ARTIMI.COM>
From: "Mike Marchywka" <marchywka AT hotmail DOT com>
To: dave DOT korn AT artimi DOT com, cygwin AT cygwin DOT com
Subject: RE: possible compiler optimization error
Date: Thu, 28 Jun 2007 13:50:32 -0400
Mime-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

I sent a private reply to the user but, without looking at the code, some 
compiler
options give up consistency for sake of speed. And, if you are really using
floating point as intended, and not doing something like making arthmetic
encoders, you should NEVER need to do a floating point equality compare.

It is entirely possible that two sequential "==" tests are comparing 
differently
rounded numbers- in one case it could be something left in a register and in
another compare it is looking at something that changed precision during a
store/load.

You would really need to look at the generated code to get some idea
what is going on but I would suspect precisions issues as much as
corruption/NaN etc.


>From: "Dave Korn" <dave DOT korn AT artimi DOT com>
>To: <cygwin AT cygwin DOT com>
>Subject: RE: possible compiler optimization error
>Date: Thu, 28 Jun 2007 18:39:19 +0100
>
>On 28 June 2007 18:19, Frederich, Eric P21322 wrote:
>
> > On Windows I have found that a program I wrote fails when compiled with
> > -O1 and -O2 but runs fine with -O0.
> > The program behaves correctly on Linux and Solaris with or without
> > optimizations.
>
>   Your code has a bug, most likely an uninitialised or otherwise stray
>pointer, but could be anything that causes undefined behaviour.  It works 
>on
>Linux/Solaris by good fortune, because whatever memory addresses you're
>stomping all over just happen to be free and safe to stomp on on those
>platforms, whereas windows systems have different process space layout
>
> > If a program compiled with -O0 has different output than the same
> > program compiled with -O1 or -O2, is that defiantly a compile error?
>
>   No.  Very occasionally it is a genuine compiler bug in one of the
>optimisation passes, but the *vast* majority of such 'bugs' are actually in
>the source code fed to the compiler.  (Like many utilities, the compiler
>cannot always detect when it is fed invalid input, and may sometimes 
>silently
>produce invalid output as a result.)
>
>   Now, there /could/ be a compiler bug, but unless you can present us with 
>a
>testcase that we can compile ourselves and test out, it's not going to be 
>easy
>to help you.  Fragmentary code snippets aren't useful.  For advice on how 
>to
>write a really good compiler bug report, see the guidelines at
>http://gcc.gnu.org/bugs.html
>
>
>     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/
>

_________________________________________________________________
Who's that on the Red Carpet? Play & win glamorous prizes. 
http://club.live.com/red_carpet_reveal.aspx?icid=REDCARPET_hotmailtextlink3


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