caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Li-Thiao-Té Sébastien" <Sebastien.Li-thiao-te@crans.org>
To: caml-list@yquem.inria.fr
Subject: Caml interface with C on x86_64
Date: Wed, 08 Mar 2006 23:06:34 +0100	[thread overview]
Message-ID: <440F556A.9010209@crans.org> (raw)

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


             reply	other threads:[~2006-03-08 22:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08 22:06 Li-Thiao-Té Sébastien [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=440F556A.9010209@crans.org \
    --to=sebastien.li-thiao-te@crans.org \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).