First Last Prev Next    No search results available
Details
: VMCore mishandles double -0.0
Bug#: 218
: libraries
: Core LLVM classes
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.2

:
: miscompilation
:
: 216
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-02-01 12:13
While looking into Bug 216, I noticed that storing -0.0 (which is double
0x8000000000000000) to a bytecode file and reading it back in causes it to lose
its sign.  I would guess that this is the same problem as Bug 212.

-Chris
------- Comment #1 From Chris Lattner 2004-02-01 16:06:38 -------
Just a note, this looks like the ValueMap (an std::map) in Constants.cpp cannot
differentiate between -0.0 and 0.0.  Grr.  I wonder if < does not work for 0 and -0?

-Chris
------- Comment #2 From Chris Lattner 2004-02-01 16:10:09 -------
Yup, it looks like C, at least on X86, considers -0.0 and 0.0 to be to be equal!
 In particular, both -0.0 < 0.0   AND  0.0 < -0.0 are false.  No wonder std::map
gets confused.

Bork.

-Chris
------- Comment #3 From Chris Lattner 2004-02-01 16:50:37 -------
Fixed.  Testcase here:
test/Regression/Assembler/2004-02-01-NegativeZero.llx

Patches:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040126/011055.html
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040126/011056.html

Comparisons between 0.0 and -0.0 are trixy!

-Chris

First Last Prev Next    No search results available