public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: c_huang@21cn.com
To: gcc-gnats@gcc.gnu.org
Subject: optimization/2560: Optimization cause wrong result
Date: Mon, 16 Apr 2001 09:16:00 -0000	[thread overview]
Message-ID: <20010416161337.20514.qmail@sourceware.cygnus.com> (raw)

>Number:         2560
>Category:       optimization
>Synopsis:       Optimization cause wrong result
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 16 09:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     c_huang@21cn.com
>Release:        gcc 2.96
>Organization:
>Environment:
RedHat LINUX 7.0 on HP Vectra XU, Pro 200, 64M
>Description:
Optimization level 3 will cause to get wrong result. However, if you change to level 2 or modify the sentense, you will get right results
>How-To-Repeat:
------wrong result-----
$ gcc -O3 tt.cpp -o tt -D makeerr=1
$ ./tt
64 bits: 00005CBA9063FC00 101956356144128

32 bits low: 9063FC00 2422471680

32 bits high 00005CBA    23738

996 Days 21:3:10           <------wrong
clk=4000000 CPS=1000000
CPU clock = 199463975
-----right result-----
$ gcc -O3 tt.cpp -o tt -D makeerr=0
$ ./tt
64 bits: 00005CBB1F9C75AA 101958758987178

32 bits low: 1F9C75AA 530347434

32 bits high 00005CBB    23739

5 Days 21:51:10            <-----right
clk=4010000 CPS=1000000
CPU clock = 199656522
-----right result-----
$ gcc -O2 tt.cpp -o tt -D makeerr=1
$ ./tt
64 bits: 00005CEB7D3B0089 102166488088713

32 bits low: 7D3B0089 2101018761

32 bits high 00005CEB    23787

5 Days 22:12:4             <-----right
clk=4010000 CPS=1000000
CPU clock = 199573463
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-04-16  9:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-16  9:16 c_huang [this message]
2002-03-17 18:38 rodrigc
2002-03-19 23:06 Congshi Huang
2002-03-20  6:27 rodrigc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010416161337.20514.qmail@sourceware.cygnus.com \
    --to=c_huang@21cn.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).