public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: optimization/7719: gcc with -O2 generates wrong code
Date: Wed, 19 Feb 2003 14:56:00 -0000	[thread overview]
Message-ID: <20030219145600.7209.qmail@sources.redhat.com> (raw)

The following reply was made to PR optimization/7719; it has been noted by GNATS.

From: Eric Botcazou <ebotcazou@libertysurf.fr>
To: Petr.Savicky@ff.cuni.cz
Cc: gcc-bugs@gcc.gnu.org,
 nobody@gcc.gnu.org,
 gcc-gnats@gcc.gnu.org
Subject: Re: optimization/7719: gcc with -O2 generates wrong code
Date: Wed, 19 Feb 2003 15:53:38 +0100

 > Yes, using -O2 together with -ffloat-store eliminates the problem.
 > Moreover, the fact that a double value may change just by storing
 > and reloading from memory explains the behaviour of the program.
 
 Thanks for the quick feedback.
 
 > OK, this is not a bug of the compiler itself, but it is a bug in
 > the default settings of gcc on x86. Everybody knows that the results
 > of computer arithmetic are not safe, may have different results on
 > different processors and definitely do not satisfy things like
 > (a+b)+c = a+(b+c). Here, however, the problem is not in the operations
 > with the numbers, but with keeping their values untouched. The value of a
 > variable changes during a sequence of operations which do not involve it.
 > The change may influence not only equality tests, but also inequality
 > tests, which cannot be avoided. This is hard to accept as a correct
 > behaviour even on a processor with a conceptually buggy design.
 
 You might want to try '-march=pentium[34] -mfpmath=sse' then, if you have of 
 course the right hardware.
 
 > The current success of GNU Project heavily relies on using its
 > software on x86. Perhaps, this may be a reason to be more friendly
 > to this processor and put -ffloat-store into the definition of -O2,
 > which is frequently used as a default.
 
 As someone else said, '-ffloat-store' is a big hammer which seriously harms
 the runtime performance of programs.
 
 -- 
 Eric Botcazou


             reply	other threads:[~2003-02-19 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-19 14:56 Eric Botcazou [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-14 11:30 ebotcazou
2003-02-19 14:16 Petr.Savicky
2003-02-19  8:35 ebotcazou
2002-08-25 18:16 Petr.Savicky

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=20030219145600.7209.qmail@sources.redhat.com \
    --to=ebotcazou@libertysurf.fr \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@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).