caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <christophe@raffalli.eu>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Global roots
Date: Mon, 21 Dec 2020 21:40:24 +0100	[thread overview]
Message-ID: <X+EIOESufd+dxKEa@oulala> (raw)
In-Reply-To: <CAH=h3gE16Hypo8+zMns6zLrgYwUj7-jeTNja9TPSb0G8WxE3vQ@mail.gmail.com>

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

Le 20-12-21 19:37:54, Xavier Leroy a écrit :
> On Sun, Dec 20, 2020 at 8:57 PM <christophe@raffalli.eu> wrote:
>
>     Hello,
>
>     May global roots be initialized to (value)NULL ?
>
>
> Yes, in the default OCaml configuration as of today.
>
> No, in the "no naked pointers" mode that was introduced in OCaml 4.02.0, made
> much stricter in OCaml 4.12.0, and will be the default in OCaml 5.0.
>
> To be future-proof and on the safe side, I would suggest to initialize to e.g.
> Val_unit.
>

Hello,

Thanks for the help.

I took a stronger path and initialized to (fun _ -> assert false).

I added an issue in github for improving the documentation for typing constraints
in the foreign C interface for OCaml.

It seems I have no more segfault (not sure yet as the segfault was no reproductible).
This is strange because I am using 4.11.1+flambda and the documentation says that
using out of heap pointer (i.e. NULL ?) is depreacated for 4.11, but should work?

Christophe

>
>     I have a multithreaded program, which segfault in callback_asm, while I
>     think I respect all rules of c interfaces... Except maybe the above...
>
>
> There is an OPAM compiler switch "4.10.0+nnpcheck" that adds run-time checks
> for ill-formed values according to the no-naked-pointers rules.  Maybe you
> could use it to rule out this potential problem.
>
> Hope this helps,
>
> - Xavier Leroy
>
>
>
>     Chevets,
>     Christophe
>     --
>     Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma
>     brièveté.
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-12-21 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20 19:56 christophe
2020-12-20 22:22 ` christophe
2020-12-21 18:37 ` Xavier Leroy
2020-12-21 20:40   ` Christophe Raffalli [this message]
2020-12-21 21:03     ` Christophe Raffalli
2020-12-21 22:32       ` ygrek
2020-12-21 23:11         ` Christophe Raffalli

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=X+EIOESufd+dxKEa@oulala \
    --to=christophe@raffalli.eu \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@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).