This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
- From: "fsmith at mathworks dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2005 13:48:19 -0000
- Subject: [Bug c/21607] Optimizations convert 0 to -0 leading to difference in answers.
- References: <20050516134545.21607.fsmith@mathworks.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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