public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers.
@ 2005-05-16 13:46 fsmith at mathworks dot com
2005-05-16 13:48 ` [Bug c/21607] " fsmith at mathworks dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: fsmith at mathworks dot com @ 2005-05-16 13:46 UTC (permalink / raw)
To: gcc-bugs
Hi,
Sorry for the missing information above. gcc -v did not supply the above
information and for reasons unknown to me gccbug was not installed on the
system in question.
Compiling with -O changes the results of this program.
double u_im = 0;
extern double atan(double);
extern int printf(const char *str,...);
int main(void)
{
double y;
double b;
/* Becomes -0 with optimizations and 0 without. */
b = 0 - 3*u_im;
y = atan(-7/b);
printf("b = %g\n",b);
printf("atan(-7/b) = %g\n",y);
if(y >= 0) {
printf("Error happened!\n");
}
return (y>=0);
}
--
Summary: Optimizations convert 0 to -0 leading to difference in
answers.
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fsmith at mathworks dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
@ 2005-05-16 13:48 ` fsmith at mathworks dot com
2005-05-16 13:49 ` fsmith at mathworks dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fsmith at mathworks dot com @ 2005-05-16 13:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fsmith at mathworks dot com 2005-05-16 13:48 -------
Created an attachment (id=8901)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8901&action=view)
Minimal self-contained C program exhibiting problem
The answer provided by this program changes depending on whether or
not optimizations are turned on.
The reason for the difference is that the value b changes between 0
and -0 depending on the optimization level.
Here is some sample output:
% gcc emtst_asinh_standalone.c
b = 0
atan(-7/b) = -1.5708
% gcc -O emtst_asinh_standalone.c
b = -0
atan(-7/b) = 1.5708
Error happened!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
2005-05-16 13:48 ` [Bug c/21607] " fsmith at mathworks dot com
@ 2005-05-16 13:49 ` fsmith at mathworks dot com
2005-05-16 13:51 ` fsmith at mathworks dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fsmith at mathworks dot com @ 2005-05-16 13:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fsmith at mathworks dot com 2005-05-16 13:49 -------
Created an attachment (id=8902)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8902&action=view)
Pre-processed version of previous attachment.
Preprocessed version of previous file. The previous C file was self-contained
so the only benefit you got was deleting my comments.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
2005-05-16 13:48 ` [Bug c/21607] " fsmith at mathworks dot com
2005-05-16 13:49 ` fsmith at mathworks dot com
@ 2005-05-16 13:51 ` fsmith at mathworks dot com
2005-05-16 13:53 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: fsmith at mathworks dot com @ 2005-05-16 13:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fsmith at mathworks dot com 2005-05-16 13:50 -------
Information from gcc -save-temps -v follows:
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
/usr/libexec/gcc/darwin/ppc/3.3/cc1 -E -quiet -v -D__GNUC__=3 -
D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -D__APPLE_CC__=1495 -D__DYNAMIC__
emtst_asinh_standalone.c -fPIC -O emtst_asinh_standalone.i
ignoring nonexistent directory "/usr/ppc-darwin/include"
ignoring nonexistent directory "/Local/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include/gcc/darwin/3.3
/usr/include
End of search list.
Framework search starts here:
/System/Library/Frameworks
/Library/Frameworks
End of framework search list.
/usr/libexec/gcc/darwin/ppc/3.3/cc1 -fpreprocessed emtst_asinh_standalone.i -
fPIC -quiet -dumpbase emtst_asinh_standalone.c -auxbase
emtst_asinh_standalone -O -version -o emtst_asinh_standalone.s
GNU C version 3.3 20030304 (Apple Computer, Inc. build 1495) (ppc-darwin)
compiled by GNU C version 3.3 20030304 (Apple Computer, Inc. build
1495).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=131072
/usr/libexec/gcc/darwin/ppc/as -arch ppc -o emtst_asinh_standalone.o
emtst_asinh_standalone.s
ld -arch ppc -dynamic -o a.out -lcrt1.o -lcrt2.o -L/usr/lib/gcc/darwin/3.3 -
L/usr/lib/gcc/darwin -L/usr/libexec/gcc/darwin/ppc/3.3/../../..
emtst_asinh_standalone.o -lgcc -lSystem |
c++filt3
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet| |1495
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
` (2 preceding siblings ...)
2005-05-16 13:51 ` fsmith at mathworks dot com
@ 2005-05-16 13:53 ` pinskia at gcc dot gnu dot org
2005-05-16 14:04 ` fsmith at mathworks dot com
2005-05-16 14:09 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-16 13:53 -------
This is a bug in Apple's GCC, it uses fmadd instructions when it is not safe, please report this to Apple,
I think it is fixed in Apple's 4.0.0 GCC based compiler.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
` (3 preceding siblings ...)
2005-05-16 13:53 ` pinskia at gcc dot gnu dot org
@ 2005-05-16 14:04 ` fsmith at mathworks dot com
2005-05-16 14:09 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: fsmith at mathworks dot com @ 2005-05-16 14:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From fsmith at mathworks dot com 2005-05-16 14:04 -------
How do I report it to Apple? On their site
http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/gccbug.html#gccbug
they told me to report it here (effectively). But since, for reasons unknown to
me, gccbug wasn't installed on the MAC I was using I went straight to bugzilla.
-Fred
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
` (4 preceding siblings ...)
2005-05-16 14:04 ` fsmith at mathworks dot com
@ 2005-05-16 14:09 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-16 14:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-16 14:08 -------
(In reply to comment #5)
> How do I report it to Apple? On their site
>
> http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/gccbug.html#gccbug
http://bugreport.apple.com
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21607
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-05-16 14:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-16 13:46 [Bug c/21607] New: Optimizations convert 0 to -0 leading to difference in answers fsmith at mathworks dot com
2005-05-16 13:48 ` [Bug c/21607] " fsmith at mathworks dot com
2005-05-16 13:49 ` fsmith at mathworks dot com
2005-05-16 13:51 ` fsmith at mathworks dot com
2005-05-16 13:53 ` pinskia at gcc dot gnu dot org
2005-05-16 14:04 ` fsmith at mathworks dot com
2005-05-16 14:09 ` pinskia at gcc dot gnu dot org
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).