public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/4251: Bug in optimization of floating-point code
@ 2001-09-30 11:56 aoliva
  0 siblings, 0 replies; 3+ messages in thread
From: aoliva @ 2001-09-30 11:56 UTC (permalink / raw)
  To: Bart.VanAssche, gcc-bugs, gcc-prs, nobody

Synopsis: Bug in optimization of floating-point code

State-Changed-From-To: feedback->closed
State-Changed-By: aoliva
State-Changed-When: Sun Sep 30 11:56:00 2001
State-Changed-Why:
    Reported confirmed that the difference was caused by excess precision.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4251&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: optimization/4251: Bug in optimization of floating-point code
@ 2001-09-28 20:20 aoliva
  0 siblings, 0 replies; 3+ messages in thread
From: aoliva @ 2001-09-28 20:20 UTC (permalink / raw)
  To: Bart.VanAssche, gcc-bugs, gcc-prs, nobody

Synopsis: Bug in optimization of floating-point code

State-Changed-From-To: open->feedback
State-Changed-By: aoliva
State-Changed-When: Fri Sep 28 20:20:13 2001
State-Changed-Why:
    See whether -ffloat-store ``fixes'' the problem.  If it does, you're being bitten by the excess precision in x86's FP registers.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4251&database=gcc


^ permalink raw reply	[flat|nested] 3+ messages in thread

* optimization/4251: Bug in optimization of floating-point code
@ 2001-09-06 10:36 Bart.VanAssche
  0 siblings, 0 replies; 3+ messages in thread
From: Bart.VanAssche @ 2001-09-06 10:36 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4251
>Category:       optimization
>Synopsis:       Bug in optimization of floating-point code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 06 10:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Bart Van Assche
>Release:        both 2.95.3 and 3.0
>Organization:
>Environment:
RedHat Linux 6.1 with 2.4.7 kernel
>Description:
When compiling the attached program with -O0, the program
exits with exit code 0 (echo $?) -- this is OK. When
compiling the attached program with -O2 however, then it
exits with exit code 1 -- this is wrong. I'm not sure
whether this really is a bug in the optimizer or the result
of rounding effects, but it is really something strange.
BTW, when replacing "<" by ">", the problem disappears.
It also looks like the problem only occurs when "step" has
a lot of bits behind the binary point (e.g. 0.1, 0.2 or
0.3, but not 0.5 or 0.25).
>How-To-Repeat:
g++ -O0 -Wall NormalizeFloat.cpp && (./a.out;echo $?)
g++ -O2 -Wall NormalizeFloat.cpp && (./a.out;echo $?)
will give you the output 0 and 1 on separate lines.
>Fix:
Either turn optimization off or put one of the calls to
Normalize() in a separate statement.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="NormalizeFloat.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="NormalizeFloat.cpp"

Ly8gRGVtb25zdHJhdGlvbiBwcm9ncmFtIG9mIGEgYnVnIGluIGcrKycgb3B0aW1pemVyIC0tIEJW
QVMsIDA1LXNlcHQtMjAwMS4KLy8gV2hlbiBjb21waWxpbmcgd2l0aCAtV2FsbCAtTzA6IGV4aXQg
Y29kZSBpcyAwIChPSykuCi8vIFdoZW4gY29tcGlsaW5nIHdpdGggLVdhbGwgLU8yOiBleGl0IGNv
ZGUgaXMgMSAoV1JPTkcpLgoKIyBkZWZpbmUgX19NQVRIX0lOTElORSBfX2lubGluZQojZGVmaW5l
IF9fQ09OQ0FUKGEsYikgYSMjYgojZGVmaW5lIF9faW5saW5lX21hdGhjb2RlXyhmbG9hdF90eXBl
LCBmdW5jLCBhcmcsIGNvZGUpIFwKICBfX01BVEhfSU5MSU5FIGZsb2F0X3R5cGUgZnVuYyAoZmxv
YXRfdHlwZSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogIF9fTUFUSF9JTkxJ
TkUgZmxvYXRfdHlwZSBmdW5jIChmbG9hdF90eXBlIGFyZykgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICBcCiAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgIGNvZGU7ICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAog
IH0KIyBkZWZpbmUgX19pbmxpbmVfbWF0aGNvZGUoZnVuYywgYXJnLCBjb2RlKSBcCiAgX19pbmxp
bmVfbWF0aGNvZGVfIChkb3VibGUsIGZ1bmMsIGFyZywgY29kZSkgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgIFwKICBfX2lubGluZV9tYXRoY29kZV8gKGZsb2F0LCBfX0NPTkNBVChmdW5j
LGYpLCBhcmcsIGNvZGUpICAgICAgICAgICAgICAgICAgICAgXAogIF9faW5saW5lX21hdGhjb2Rl
XyAobG9uZyBkb3VibGUsIF9fQ09OQ0FUKGZ1bmMsbCksIGFyZywgY29kZSkKCl9faW5saW5lX21h
dGhjb2RlIChmbG9vciwgX194LCBcCiAgcmVnaXN0ZXIgbG9uZyBkb3VibGUgX192YWx1ZTsgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICBfX3ZvbGF0aWxl
IHVuc2lnbmVkIHNob3J0IGludCBfX2N3OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgXAogIF9fdm9sYXRpbGUgdW5zaWduZWQgc2hvcnQgaW50IF9fY3d0bXA7ICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgX19hc20gX192b2xhdGlsZSAoImZu
c3RjdyAlMCIgOiAiPW0iIChfX2N3KSk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwK
ICBfX2N3dG1wID0gKF9fY3cgJiAweGYzZmYpIHwgMHgwNDAwOyAvKiByb3VuZGluZyBkb3duICov
ICAgICAgICAgICAgICAgICAgICAgXAogIF9fYXNtIF9fdm9sYXRpbGUgKCJmbGRjdyAlMCIgOiA6
ICJtIiAoX19jd3RtcCkpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgX19hc20gX192
b2xhdGlsZSAoImZybmRpbnQiIDogIj10IiAoX192YWx1ZSkgOiAiMCIgKF9feCkpOyAgICAgICAg
ICAgICAgICAgIFwKICBfX2FzbSBfX3ZvbGF0aWxlICgiZmxkY3cgJTAiIDogOiAibSIgKF9fY3cp
KTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogIHJldHVybiBfX3ZhbHVlKQoKZmxv
YXQgTm9ybWFsaXplRmxvYXQoZmxvYXQgTm1iciwgZmxvYXQgU3RlcCkKewogIE5tYnIgPSBObWJy
IC8gU3RlcDsKICBObWJyID0gTm1iciArIDAuNWY7CiAgTm1iciA9IGZsb29yKE5tYnIpOwogIE5t
YnIgPSBObWJyICogU3RlcDsKICByZXR1cm4gTm1icjsKfQoKaW50IG1haW4oaW50IGFyZ2MsIGNo
YXIqKiBhcmd2KQp7CiAgcmV0dXJuIChOb3JtYWxpemVGbG9hdCgxLCAwLjEpIDwgTm9ybWFsaXpl
RmxvYXQoMSwgMC4xKSk7Cn0K


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-30 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-30 11:56 optimization/4251: Bug in optimization of floating-point code aoliva
  -- strict thread matches above, loose matches on Subject: below --
2001-09-28 20:20 aoliva
2001-09-06 10:36 Bart.VanAssche

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