-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Wrong optimization of 0 / e #7201
Copy link
Copy link
Closed
Labels
Milestone
Description
Original bug ID: 7201
Reporter: filliatr
Status: closed (set by @mshinwell on 2016-12-08T14:37:46Z)
Resolution: duplicate
Priority: normal
Severity: minor
Version: 4.02.3
Target version: 4.03.1+dev
Category: middle end (typedtree to clambda)
Monitored by: braibant @gasche @hcarty @yakobowski
Bug description
In file asmcomp/cmmgen.ml, in function div_int, the optimization
| (Cconst_int 0 as c1, c2) ->
Csequence(c2, c1)
is wrong, since c2 could be zero, as in
0 / Random.int 1
or
0 / List.hd [0]
Steps to reproduce
(* compile this code with ocamlopt and run it )
let = 0 / Random.int 1
( it does not raise Division_by_zero *)
Additional information
does not show up in ocamlc
Reactions are currently unavailable