|Anonymous | Login | Signup for a new account||2019-01-17 18:31 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0007890||OCaml||back end (clambda to assembly)||public||2019-01-02 12:12||2019-01-04 18:12|
|Target Version||Fixed in Version|
|Summary||0007890: Incorrect floating point optimizations with ocamlopt|
|Description||ocamlopt incorrectly assumes that multiple occurrences of the same floating point expressions necessarily reduce to the same value. This is not always the case since rounding mode can be changed by programs.|
|Steps To Reproduce||Compile files in attached archive with:|
ocamlopt -c roundingMode_stubs.c
ocamlopt -c roundingMode.mli
ocamlopt -c roundingMode.ml
ocamlopt roundingMode.cmx roundingMode_stubs.o testRounding.ml -o not_correct
ocamlopt roundingMode.cmx roundingMode_stubs.o testRounding_modified.ml -o correct
Executing ./not_correct or ./correct should give the same result (they do with ocamlc).
|Tags||No tags attached.|
|Attached Files||rounding.tgz [^] (1,096 bytes) 2019-01-02 12:12|
|I could be wrong, but I thought that was what the compiler's -no-float-const-prop option was for. So I don't think this is a bug, but the expected behaviour.|
edited on: 2019-01-02 14:36
I wasn't aware of this option (there are so many of them).
But I would certainly have preferred the opposite default behavior, i.e. no floating point "optimizations" by default, because it breaks functional abstraction (my example precisely shows that by factorizing out common operations the behavior of the program is changed), and it also breaks compatibility with ocamlc.
Why not having a -float-const-prop option instead, I mean require users to explicitly ask for constant propagation (knowing that it may change the semantics)?
|2019-01-02 12:12||sfuric||New Issue|
|2019-01-02 12:12||sfuric||File Added: rounding.tgz|
|2019-01-02 14:00||lpw25||Note Added: 0019522|
|2019-01-02 14:30||sfuric||Note Added: 0019523|
|2019-01-02 14:36||sfuric||Note Edited: 0019523||View Revisions|
|Copyright © 2000 - 2011 MantisBT Group|