public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/7175: Calculation yields different results for version optimized with -O2
@ 2002-12-06 13:50 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2002-12-06 13:50 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, weber

Synopsis: Calculation yields different results for version optimized with -O2

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Fri Dec  6 13:50:40 2002
State-Changed-Why:
    This code works for me with gcc3.2. Would you mind checking
    whether this helps on your system as well?
    
    Thanks
      Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7175


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

* Re: optimization/7175: Calculation yields different results for version optimized with -O2
@ 2002-12-10  6:28 bangerth
  0 siblings, 0 replies; 5+ messages in thread
From: bangerth @ 2002-12-10  6:28 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, weber

Synopsis: Calculation yields different results for version optimized with -O2

State-Changed-From-To: feedback->closed
State-Changed-By: bangerth
State-Changed-When: Tue Dec 10 06:28:23 2002
State-Changed-Why:
    Then this is not a problem of handling inaccuracies, but of
    handling excess accuracy due to the idiotic x87 floating
    point representation. Read the section on non-bugs on the
    gcc homepage for a description.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7175


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

* Re: optimization/7175: Calculation yields different results for version optimized with -O2
@ 2002-12-09 20:16 Gunther H Weber
  0 siblings, 0 replies; 5+ messages in thread
From: Gunther H Weber @ 2002-12-09 20:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Gunther H Weber <weber@informatik.uni-kl.de>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, weber@informatik.uni-kl.de, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/7175: Calculation yields different results for version
 optimized with -O2
Date: Mon, 09 Dec 2002 20:13:39 -0800

 I still get the problem with gcc3.2. However, it disappears as soon as I 
 use -ffloat-store. So it seems to be due to poor handling of numerical 
 inaccuracies.
 
 Thank you for your feedback
    Gunther
 
 bangerth@dealii.org wrote:
 
 >Synopsis: Calculation yields different results for version optimized with -O2
 >
 >State-Changed-From-To: open->feedback
 >State-Changed-By: bangerth
 >State-Changed-When: Fri Dec  6 13:50:40 2002
 >State-Changed-Why:
 >    This code works for me with gcc3.2. Would you mind checking
 >    whether this helps on your system as well?
 >    
 >    Thanks
 >      Wolfgang
 >
 >http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7175
 >  
 >
 
 
 


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

* Re: optimization/7175: Calculation yields different results for version optimized with -O2
@ 2002-08-10  2:06 Michael Veksler
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Veksler @ 2002-08-10  2:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

From: Michael Veksler <veksler@il.ibm.com>
To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
   nobody@gcc.gnu.org, weber@informatik.uni-kl.de
Cc:  
Subject: Re: optimization/7175: Calculation yields different results for version
 optimized with -O2
Date: Sat, 10 Aug 2002 06:29:05 +0300

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7175
 
 The moment you will add at the beginning of your main():
   fpu_control_t fpu_bits;
   _FPU_GETCW(fpu_bits);
   fpu_bits &= ~_FPU_EXTENDED;
   fpu_bits |= _FPU_DOUBLE;
   _FPU_SETCW(fpu_bits);
 
 Assuming you init "res" to zeros, you are goint to get a consistent
 result.
 This probably means that this PR is basically the same as PR/6914.
 


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

* optimization/7175: Calculation yields different results for version optimized with -O2
@ 2002-07-01  4:56 weber
  0 siblings, 0 replies; 5+ messages in thread
From: weber @ 2002-07-01  4:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7175
>Category:       optimization
>Synopsis:       Calculation yields different results for version optimized with -O2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 04:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gunther Weber
>Release:        gcc version 3.1
>Organization:
>Environment:
RedHat Linux 7.3 running on a 800 MHz Celeron (Coppermine) processor. Problem also occurs on an AMD Athlon(tm) XP 1700+ system.
GCC Build option:
Reading specs from /usr/global/lib/gcc-lib/i586-pc-linux-gnu/3.1/specs
Configured with: ./configure --prefix=/usr/global --enable-threads=posix
Thread model: posix
gcc version 3.1
>Description:
A program that calculates an expression yields different results when compiled with -O2 option as compared to -O1 or no optimization. The file attachment contains code with everything but the necessary code to reproduce the bug was removed. Note that trying to print variable conntents for debugging purposes gets rid of the bug. A complete log of compiling the program and its results is listed under How-To-Reperat.
>How-To-Repeat:
[weber@stella TestGCC]$ g++3.1 test.cc
[weber@stella TestGCC]$ ./a.out
Using second solution t=0
0.131997, 0.69765
[weber@stella TestGCC]$ g++3.1 -O1 test.cc
[weber@stella TestGCC]$ ./a.out
Using second solution t=0
0.131997, 0.69765
[weber@stella TestGCC]$ g++3.1 -O2 test.cc
[weber@stella TestGCC]$ ./a.out
Using second solution t=4.14165e-17
0.568462, -0.302107
[weber@stella TestGCC]$ g++3.1 -O2 -DPRINT_T test.cc
[weber@stella TestGCC]$ ./a.out
t1=2 t2=0
Using second solution t=0
0.131997, 0.69765
>Fix:
None that I know of except not to use -O2 option.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;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w8
dDI8PHN0ZDo6ZW5kbDsKI2VuZGlmCglpZiAoMDw9dDEgJiYgdDE8PTEpIHsKCSAgUlswXSA9IHhN
ICsgdDEqYWxwaGE7CgkgIFJbMV0gPSB5TSArIHQxKmJldGE7CgkgIHN0ZDo6Y291dCA8PCAiVXNp
bmcgZmlyc3Qgc29sdXRpb24gdD0iIDw8IHQxIDw8IHN0ZDo6ZW5kbDsKCX0KCWVsc2UgaWYgKDA8
PXQyICYmIHQyPD0xKSB7CgkgIFJbMF0gPSB4TSArIHQyKmFscGhhOwoJICBSWzFdID0geU0gKyB0
MipiZXRhOwoJICBzdGQ6OmNvdXQgPDwgIlVzaW5nIHNlY29uZCBzb2x1dGlvbiB0PSIgPDwgdDIg
PDwgc3RkOjplbmRsOwoJfQogICAgICB9CiAgICB9CiAgfQp9CgppbnQgbWFpbigpCnsKICBkb3Vi
bGUgcFsyXSA9IHsgMC4yNjM5OTUsIDEgfTsKICBkb3VibGUgcVsyXSA9IHsgMCwgMC4zOTUyOTkg
fTsKICBkb3VibGUgcmVzWzJdOwogIGNvbXB1dGUocmVzLCAwLjExNTYyNSwgMC43ODU2MTksIDAu
NDkzMTE5LCAtMC4xNzY4NzUsIDAsIHAsIHEpOwogIHN0ZDo6Y291dCA8PCByZXNbMF0gPDwgIiwg
IiA8PCByZXNbMV0gPDwgc3RkOjplbmRsOwp9Cgo=


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

end of thread, other threads:[~2002-12-10 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-06 13:50 optimization/7175: Calculation yields different results for version optimized with -O2 bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-12-10  6:28 bangerth
2002-12-09 20:16 Gunther H Weber
2002-08-10  2:06 Michael Veksler
2002-07-01  4:56 weber

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