OCaml Forge
SCM

Detail: [#872] pa_ocamlviz: breaks mutually recursive functions

Bugs: Browse | Download .csv | Monitor

[#872] pa_ocamlviz: breaks mutually recursive functions

Date:
2011-01-11 11:26
Priority:
3
State:
Open
Submitted by:
Török Edwin (edwin)
Assigned to:
Nobody (None)
Hardware:
None
Resolution:
None
Severity:
None
Version:
None
Component:
None
Operating System:
None
Product:
None
 
URL:
Summary:
pa_ocamlviz: breaks mutually recursive functions

Detailed description
Here is a testcase, where it wrongly removes the 'rec' specification from the top 'foo':
$ cat >x.ml <<EOF
let rec foo a =
bar a
and bar a = a+1;;
EOF

$ ocamlc -pp 'camlp4o str.cma /home/edwin/ocaml/ocamlviz-1.01/camlp4/pa_ocamlviz.cmo' -I +ocamlviz x.ml
File "x.ml", line 2, characters 4-7:
Error: Unbound value bar

$ camlp4o str.cma ~/ocaml/ocamlviz-1.01/camlp4/pa_ocamlviz.cmo x.ml
let foo__pobs = Ocamlviz.Point.create "x_foo"

let foo__tobs = Ocamlviz.Time.create "x_foo"

let bar__pobs = Ocamlviz.Point.create "x_bar"

let bar__tobs = Ocamlviz.Time.create "x_bar"

let foo xxx0 =
let rec foo a = bar a
in
(Ocamlviz.Time.start foo__tobs;
Ocamlviz.Point.observe foo__pobs;
let v = foo xxx0 in (Ocamlviz.Time.stop foo__tobs; v))
and bar xxx0 =
let rec bar a = a + 1
in
(Ocamlviz.Time.start bar__tobs;
Ocamlviz.Point.observe bar__pobs;
let v = bar xxx0 in (Ocamlviz.Time.stop bar__tobs; v))

ocaml 3.11.2
ocamlviz 1.01

Followup

Message
Date: 2011-01-11 11:40
Sender: Török Edwin

Workaround, disable the "let rec" processing:

--- camlp4/pa_ocamlviz.ml 2009-08-31 17:20:52.000000000 +0300
+++ /tmp/pa_ocamlviz.ml 2011-01-11 13:39:08.532428024 +0200
@@ -153,7 +153,7 @@

[[
"let"; "rec"; b = binding ->
- begin try
+(* begin try
fun_idents := [];
let b = binding_map true _loc b in
let str = List.fold_left (fun str (id,_) ->
@@ -165,9 +165,9 @@
<:str_item< let $binding:b$ ;; >> !fun_idents
in
str
- with CannotModifyThis ->
+ with CannotModifyThis ->*)
<:str_item< let rec $binding:b$ ;; >>
- end
+(* end*)

|
"let"; b = binding ->

Attached Files:

Changes:

No Changes Have Been Made to This Item