Version française
Home     About     Download     Resources     Contact us    
Browse thread
AMD64 segfault
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] AMD64 segfault
On Fri, 2005-05-13 at 08:35, skaller wrote:
> I just built caml 3.08.3 on my new AMD64 and compiled and ran the usual
> hello world with ocamlopt.opt, however the Felix compiler segfaults.
> The bytecode version runs fine.  Felix uses bignums and unix, otherwise
> it is a pure ocaml program (no 3pl C libraries).
> 
> I have no idea where start looking. I'm running Ubuntu (Hoary) 
> and using gcc 3.4.
> 
> Any hints?

I have found the error occurs in a particular part of the
program -- the instantiator, which takes a generic entity
and instantiates it ..

I added a debugging print in an attempt to 'binary chop'
to the line with the error.. unfortunately that magically
fixes the problem.

Using gdb I get a message saying the SIGSEGV is in caml_apply5().
Anyone know what that is doing?

More fiddling indicates the problem occurs in the code below.

1. As written it crashes.

2. uncommenting the 'processing exe' does not fix the problem,
the diagnostic is not emitted before the segfault

3. uncommenting "doing exes", the diagnost IS printed before
the segfault

4. uncommenting "Process function" the segfault doesn't occur 
at all

Note that 'process_function' is just a forwarding
function that forgets some arguments ..

-------------------------------------
and process_exes syms bbdfns ref_insts1 ts hvarmap exes = 
  print_endline "Doing exes";
  iter (process_exe syms bbdfns ref_insts1 ts hvarmap) exes
-----------------------------------------------------

Full code below from 'src.flx_inst.ml" in Felix version 1.0.23

----------------------------------------------------------------
and process_exe syms bbdfns ref_insts1 ts hvarmap (exe:bexe_t) =
  let ue sr e = process_expr syms bbdfns ref_insts1 hvarmap sr e in
  let uis i ts = add_inst syms ref_insts1 (i,ts) in
  let ui i = uis i ts in
  (*
  print_endline ("processing exe " ^ string_of_bexe syms.dfns 0 exe);
  *)
  match exe with
.... elided ........  
    -> ()

and process_exes syms bbdfns ref_insts1 ts hvarmap exes = 
  print_endline "Doing exes";
  iter (process_exe syms bbdfns ref_insts1 ts hvarmap) exes

and process_function syms bbdfns hvarmap ref_insts1 index sr argtypes
ret exes ts =
  (*
  print_endline ("Process function " ^ si index);
  *)
  process_exes syms bbdfns ref_insts1 ts hvarmap exes 



-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net