This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/21067] New: Excessive optimization of floating point expression
- From: "bagnara at cs dot unipr dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Apr 2005 07:23:34 -0000
- Subject: [Bug middle-end/21067] New: Excessive optimization of floating point expression
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compiling the following with GCC 3.4.3 (with "gcc -O2 -S file.c")
float mul2(float a, float b) {
float v = -a * b;
return -v;
}
produce the erroneous code
pushl %ebp
movl %esp, %ebp
flds 8(%ebp)
fmuls 12(%ebp)
popl %ebp
ret
where the sign changes have been erroneously elided.
Notice that, depending on the rounding mode in effect,
this produces the wrong results.
Strangely enough, the code produced for
float div2(float a, float b) {
float v = -a / b;
return -v;
}
is instead correct.
--
Summary: Excessive optimization of floating point expression
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bagnara at cs dot unipr dot it
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21067