Re: [Caml-list] Problem with the compiler 3.12.1

2012-04-27 Thread Claire Dross

On 25/04/2012 10:04, Claire Dross wrote:

On 16/04/2012 17:52, Claire Dross wrote:

Hello,

I am new to caml-list, so sorry in advance if it is not the right 
place to make this post. In a quite important piece of ocaml code, I 
have a function:


let matching_term terms env uf id (pats, subst) (seen, forms) =
match pats, subst with
  | _, [] | [], _ - seen, forms
  | t :: pats, _ - fprintf fmt%a@. T.print t;
let acc = matchpats env terms uf (subst, seen, id+1) t in
let acc, seen, _ = List.fold_left (matchpats env env.fils uf)
  acc pats in
seen, List.rev_append acc forms

Removing the print in the second case of the match changes the result 
of the compiled file (compiler 3.12.1 byte code and for linux)) on 
one of my tests. T.print does not have side effects, it recursively 
prints a hashconsed term structure.


Using the compiler 3.11.2 instead of the 3.12.1 removes the problem. 
My function returns the correct result with and without the print.


Thanks again to everyone that took time to help me,

Claire Dross

The problem is caused by the garbage collector (launched because Format 
creates a lot of things) that introduces non-determinism in the order of 
elements in a weak hash table.


--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Problem with the compiler 3.12.1

2012-04-25 Thread Claire Dross

On 16/04/2012 17:52, Claire Dross wrote:

Hello,

I am new to caml-list, so sorry in advance if it is not the right 
place to make this post. In a quite important piece of ocaml code, I 
have a function:


let matching_term terms env uf id (pats, subst) (seen, forms) =
match pats, subst with
  | _, [] | [], _ - seen, forms
  | t :: pats, _ - fprintf fmt%a@. T.print t;
let acc = matchpats env terms uf (subst, seen, id+1) t in
let acc, seen, _ = List.fold_left (matchpats env env.fils uf)
  acc pats in
seen, List.rev_append acc forms

Removing the print in the second case of the match changes the result 
of the compiled file (compiler 3.12.1 byte code and for linux)) on one 
of my tests. T.print does not have side effects, it recursively prints 
a hashconsed term structure.


Using the compiler 3.11.2 instead of the 3.12.1 removes the problem. My 
function returns the correct result with and without the print.


Thanks again to everyone that took time to help me,

Claire Dross

--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs



Re: [Caml-list] Problem with the compiler 3.12.1

2012-04-18 Thread Arnaud Spiwack
Hi Claire,

Without much confidence, I would start by checking matchpats for uses of
fmt.

On 16 April 2012 17:52, Claire Dross claire.dr...@lri.fr wrote:

 Hello,

 I am new to caml-list, so sorry in advance if it is not the right place to
 make this post. In a quite important piece of ocaml code, I have a function:

 let matching_term terms env uf id (pats, subst) (seen, forms) =
match pats, subst with
  | _, [] | [], _ - seen, forms
  | t :: pats, _ - fprintf fmt%a@. T.print t;
let acc = matchpats env terms uf (subst, seen, id+1) t in
let acc, seen, _ = List.fold_left (matchpats env env.fils uf)
  acc pats in
seen, List.rev_append acc forms

 Removing the print in the second case of the match changes the result of
 the compiled file (compiler 3.12.1) on one of my tests. T.print does not
 have side effects, it recursively prints a hashconsed term structure.

 Do you have any idea of what the problem is ?

 Thanks a lot,

 Claire Dross

 --
 Caml-list mailing list.  Subscription management and archives:
 https://sympa-roc.inria.fr/**wws/info/caml-listhttps://sympa-roc.inria.fr/wws/info/caml-list
 Beginner's list: 
 http://groups.yahoo.com/group/**ocaml_beginnershttp://groups.yahoo.com/group/ocaml_beginners
 Bug reports: 
 http://caml.inria.fr/bin/caml-**bugshttp://caml.inria.fr/bin/caml-bugs



-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs