Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong optimization of 0 / e #7201

Closed
vicuna opened this issue Mar 31, 2016 · 1 comment
Closed

Wrong optimization of 0 / e #7201

vicuna opened this issue Mar 31, 2016 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Mar 31, 2016

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

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @mshinwell

Superceded by #954

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant