This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16607] Incorrect FP code generated in member data initialization
- From: "npr1 at suomi24 dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jul 2004 14:39:58 -0000
- Subject: [Bug c++/16607] Incorrect FP code generated in member data initialization
- References: <20040717172049.16607.npr1@suomi24.fi>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From npr1 at suomi24 dot fi 2004-07-19 14:39 -------
Personally, I don't mind floats being imprecise in the last few bits, or doubles
being imprecise in their last few bits. What I do mind is that after assigning
float * float to double, that double value can have "simultaneously" two values
that differ in almost half of their last bits. If this is allowed, one can never
count on double having any more practical precision than float, especially with
the duality being carried over [inlined] function calls. I'm sure many programs
rely on this but, since it's broken so rarely it's not noticed until with a new
compiler or a small non-related change in code structure. (Ouch!)
The "double = float * float" case could be fixed without performance issues,
too. The compiler could well generate code that always uses the value with extra
precision (that of double, or more). As I noted, the compiler already does this
in all cases but the one. At least in my example, using two forms (single and
double precision) of the result generates an unnecessary instruction, so
actually there would be a performance increase.
I suppose a compiler patch could be too laborious compared to the gains,
especially as it mustn't affect non-x86 compilations. My personal fix will be
converting all uses of float to double, but obviously this is not good for all
programs.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16607