Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006442OCamlOCaml backend (code generation)public2014-05-25 00:092014-05-25 18:47
ReporterBoris Yakobowski 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version4.02.0+devFixed in Version4.02.0+dev 
Summary0006442: Incorrect propagation of -0.
DescriptionIn the attached code, l should be equal to -0. This code compiled with ocamlopt from the trunk results in 0. (ocamlc exhibits no problem.) Option -no-float-const-prop has no effect.
TagsNo tags attached.
Attached Files? file icon float.ml [^] (283 bytes) 2014-05-25 00:10 [Show Content]
diff file icon patch-PR6442.diff [^] (3,691 bytes) 2014-05-25 18:47 [Show Content]

- Relationships

-  Notes
(0011562)
Boris Yakobowski (reporter)
2014-05-25 00:51

The culprit seems to be an unfortunate interaction between Alain's work on sharing constants, and Xavier's work on floating-point constant propagation. The ~shared argument to Compilenv.new_structured_constant is probably responsible for sharing 0. and -0., since Pervasives.compare does not distinguish them. Implementing a proper comparison function in Compilenv.CstMap may be the solution.
(0011563)
Boris Yakobowski (reporter)
2014-05-25 01:01

I'm not OCaml-compiler savvy enough to fix the comparison function, but I can confirm that disabling the sharing of float constants in closure.ml fixes our issue.
(0011565)
xleroy (administrator)
2014-05-25 17:20

Hello Boris,

I confirm that the problem is sharing of constants that are equal in the sense of (=). Constant propagation is innocent :-) Will look into it soon.
(0011566)
xleroy (administrator)
2014-05-25 18:47

Fixed in 4.02 branch (commit 14916) and on trunk (commit 14917). Patch against 4.02 is attached.

- Issue History
Date Modified Username Field Change
2014-05-25 00:09 Boris Yakobowski New Issue
2014-05-25 00:10 Boris Yakobowski File Added: float.ml
2014-05-25 00:51 Boris Yakobowski Note Added: 0011562
2014-05-25 01:01 Boris Yakobowski Note Added: 0011563
2014-05-25 17:20 xleroy Note Added: 0011565
2014-05-25 17:20 xleroy Status new => confirmed
2014-05-25 17:20 xleroy Target Version => 4.02.0+dev
2014-05-25 18:47 xleroy Note Added: 0011566
2014-05-25 18:47 xleroy Status confirmed => resolved
2014-05-25 18:47 xleroy Resolution open => fixed
2014-05-25 18:47 xleroy Fixed in Version => 4.02.0+dev
2014-05-25 18:47 xleroy File Added: patch-PR6442.diff


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker