From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2683 invoked by alias); 8 Sep 2002 14:46:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 2664 invoked by uid 71); 8 Sep 2002 14:46:00 -0000 Resent-Date: 8 Sep 2002 14:46:00 -0000 Resent-Message-ID: <20020908144600.2663.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jcas@netcabo.pt Received: (qmail 963 invoked by uid 61); 8 Sep 2002 14:36:46 -0000 Message-Id: <20020908143646.962.qmail@sources.redhat.com> Date: Sun, 08 Sep 2002 07:46:00 -0000 From: jcas@netcabo.pt Reply-To: jcas@netcabo.pt To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/7857: Different behaviour if compiled with optimization! X-SW-Source: 2002-09/txt/msg00117.txt.bz2 List-Id: >Number: 7857 >Category: c >Synopsis: Different behaviour if compiled with optimization! >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Sep 08 07:46:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Jose Santos >Release: 3.10 >Organization: >Environment: Windows XP >Description: If code is compiled with any optimization (-O1 to -O3) it has a different behaviour than with compiled with no optimizations. The code is related with precision errors.With optimizations there are no precision errors, without optimization there's a precision error! >How-To-Repeat: Just run the file with -O3 and without -O3 and see that in first case it runs fine(requires a couple of seconds, eg: 15s), in second case it enters an infinite loop(and just ends after looping all integers back to 0) >Fix: Don't known...perhaps don't use the sqrt function ? >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="bug.c" Content-Disposition: inline; filename="bug.c" #include #include /* Compile with -O3 and runs fine without there's a precision error. SQ's value has the correct value with -O3 (+1 than without -O3 for n==46611179) E-mail me at jcas@netcabo.pt */ #define NUMPAIRS 10 int main(){ long long n=2, count = 0; for(n=2; count