Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Bug in typing polymorphic variants found
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Luc Maranget <luc.maranget@i...>
Subject: Re: [Caml-list] Bug in typing polymorphic variants found

> I expect there is a bug somewhere in your program...
> 
> It is a good idea to make your makefiles to work with both ocamlc and
> ocamlopt, because ocamlc gives you much more debugging information.
> Some segmentation faults with ocamlopt give actually informative
> errors with ocamlc.
> 
> By the way, I got errors trying to compile felix, because there was an
> old src/flx_parse.ml, which should not be there.
> 

I did the same thing, and even ran felix under ocamldebug
(another reason to use both bytecode and native compilation)

1. I has to alter Flx_lex to compile
  (suppress a self reference to the Flx_lex module)

2. By running the example (run), until it crashed
   going back (back) in execution a little, and looking at the
   call stack (backtrace), I found the loop :


#52327  Pc : 242856  Flx_pretok char 6183
#52328  Pc : 242856  Flx_pretok char 6183
#52329  Pc : 242856  Flx_pretok char 6183
#52330  Pc : 242856  Flx_pretok char 6183
#52331  Pc : 242856  Flx_pretok char 6183
#52332  Pc : 242856  Flx_pretok char 6183
#52333  Pc : 242856  Flx_pretok char 6183

etc...


Apparently the loop is in module Flx_pretok :


let pre_tokens_of_lexbuf buf state =
  let lex_it() = Flx_lex.pre_flx_lex buf state in
  let run = ref true in
  let rec get () =
    if !run
    then let t = lex_it () in
      match t with
      | [Flx_parse.ENDMARKER] ->
        run := false;
        [Flx_parse.ENDMARKER]
      | _ -> t @ get() <------- HERE is the recursive call                 
    else [Flx_parse.ENDMARKER]
  in get ()


Hope it helps,


--Luc
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners