caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Problem with the compiler 3.12.1
@ 2012-04-16 15:52 Claire Dross
  2012-04-18  9:04 ` Arnaud Spiwack
  2012-04-25  8:04 ` Claire Dross
  0 siblings, 2 replies; 4+ messages in thread
From: Claire Dross @ 2012-04-16 15:52 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Problem with the compiler 3.12.1
  2012-04-16 15:52 [Caml-list] Problem with the compiler 3.12.1 Claire Dross
@ 2012-04-18  9:04 ` Arnaud Spiwack
  2012-04-25  8:04 ` Claire Dross
  1 sibling, 0 replies; 4+ messages in thread
From: Arnaud Spiwack @ 2012-04-18  9:04 UTC (permalink / raw)
  To: Claire Dross; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

Hi Claire,

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

On 16 April 2012 17:52, Claire Dross <claire.dross@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-list<https://sympa-roc.inria.fr/wws/info/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>
>

[-- Attachment #2: Type: text/html, Size: 1938 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Problem with the compiler 3.12.1
  2012-04-16 15:52 [Caml-list] Problem with the compiler 3.12.1 Claire Dross
  2012-04-18  9:04 ` Arnaud Spiwack
@ 2012-04-25  8:04 ` Claire Dross
  2012-04-27 10:54   ` Claire Dross
  1 sibling, 1 reply; 4+ messages in thread
From: Claire Dross @ 2012-04-25  8:04 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] Problem with the compiler 3.12.1
  2012-04-25  8:04 ` Claire Dross
@ 2012-04-27 10:54   ` Claire Dross
  0 siblings, 0 replies; 4+ messages in thread
From: Claire Dross @ 2012-04-27 10:54 UTC (permalink / raw)
  To: caml-list

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-27 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-16 15:52 [Caml-list] Problem with the compiler 3.12.1 Claire Dross
2012-04-18  9:04 ` Arnaud Spiwack
2012-04-25  8:04 ` Claire Dross
2012-04-27 10:54   ` Claire Dross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).