caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Caml interface with C on x86_64
@ 2006-03-08 22:06 Li-Thiao-Té Sébastien
  2006-03-13 14:53 ` Allocating caml lists from C : possible bug on amd64 "Sayan (Sébastien Li-Thiao-Té)"
  0 siblings, 1 reply; 8+ messages in thread
From: Li-Thiao-Té Sébastien @ 2006-03-08 22:06 UTC (permalink / raw)
  To: caml-list

Hi,

I am using OCaml on two different Debian systems, a P4 machine at home 
and an Opteron machine at work. The following C function works well on 
the P4 but crashes on the Opteron with "Signal -10" :

value test_liste (value str) {
    // test function to return a list to caml
    CAMLparam1(str);
    CAMLlocal1(cons);

    printf("This is test_liste.\n");
    printf(String_val(str));
    fflush(stdout);

    cons = caml_alloc (2,0);
    Store_field (cons, 0, Val_int(3));
    Store_field (cons, 1, Val_int(0));
    if (Is_block(cons)) { printf("true\n");};
    fflush(stdout);
    printf("cons has size %i \n",Wosize_val(cons));
    fflush(stdout);
    CAMLreturn (Val_int(0));
}

called from a custom toplevel system :
external test_liste : string -> int list = "test_liste";;
test_liste "oaue";;

The function works with gcc-3.4 and gcc-4.0 on the P4 but crash with 
both on the opteron machine. Can anybody explain this error?

P4 configuration :
uname -a
Linux 2.6.15-1-686-smp #1 SMP Tue Jan 3 10:19:10 UTC 2006 i686 GNU/Linux
ocamlc -v
The Objective Caml compiler, version 3.09.1
gcc-3.4 -v
gcc version 3.4.6 20060302 (prerelease) (Debian 3.4.5-3)
gcc -v
Target: i486-linux-gnu
gcc version 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)

Opteron configuration :
uname -a
Linux 2.6.14-2-amd64-k8-smp #1 SMP Sun Nov 27 02:29:11 UTC 2005 x86_64 
GNU/Linux
ocamlc -v
The Objective Caml compiler, version 3.09.1
gcc-3.4 -v
gcc version 3.4.6 20060302 (prerelease) (Debian 3.4.5-3)
gcc -v
Target: x86_64-linux-gnu
gcc version 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)

-- 
Li-Thiao-Té Sébastien


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

end of thread, other threads:[~2006-03-13 18:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-08 22:06 Caml interface with C on x86_64 Li-Thiao-Té Sébastien
2006-03-13 14:53 ` Allocating caml lists from C : possible bug on amd64 "Sayan (Sébastien Li-Thiao-Té)"
2006-03-13 15:13   ` [Caml-list] " Markus Mottl
2006-03-13 15:54     ` "Sayan (Sébastien Li-Thiao-Té)"
2006-03-13 16:39       ` Markus Mottl
2006-03-13 17:42       ` Xavier Leroy
2006-03-13 18:05         ` Li-Thiao-Té Sébastien
2006-03-13 18:53         ` Markus Mottl

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).