From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id C7CB95D5 for ; Mon, 21 Dec 2020 18:38:28 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.78,437,1599516000"; d="scan'208,217";a="484104701" Received: from prod-listesu18.inria.fr (HELO sympa.inria.fr) ([128.93.162.160]) by mail2-relais-roc.national.inria.fr with ESMTP; 21 Dec 2020 19:38:27 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 6714FE020B; Mon, 21 Dec 2020 19:38:27 +0100 (CET) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1FC2BE020B for ; Mon, 21 Dec 2020 19:38:22 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=Xavier.Leroy@inria.fr; spf=Pass smtp.mailfrom=xavier.leroy@gmail.com; spf=None smtp.helo=postmaster@mail-wm1-f41.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AOzFBiRzQLEc4NYfXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?2+sWIJqq85mqBkHD//Il1AaPAdyEragc0aGP6/qocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZr?= =?us-ascii?q?KeTpAI7SiNm82/yv95HJbAhEmTiwbalsIBmqswndudQajZd8Jq0s1hbHv3xEdv?= =?us-ascii?q?hMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTD?= =?us-ascii?q?QhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlS?= =?us-ascii?q?EKPCM7/m7KkMx9lK1UoByjqBJ/zYDaY5ybOuRica7GZ9wWWXBMU9xNWyBdAI6x?= =?us-ascii?q?aZYEAeobPeZfqonwv1oBogGgBQmtGuzv0CJDiHno0q0g1OQgERzN0QshEN0Urn?= =?us-ascii?q?TUrcv6NL0IXe6z0qbI1zLDbvNN1Df87ojIaBEhruuWUbJ+a8rc0E8iHB7KgVuM?= =?us-ascii?q?s4LqJS+V1vgTvGiB6eptTeCih3InpQxwoDWixsQhh5XGiI4JxF7J9Th0zJg6KN?= =?us-ascii?q?GlVEN3fNqpHZpTui+UNIZ6Xt0uTmVmtSs+zrALuJ+2cTUMxZ86xBDfc+SKf5aU?= =?us-ascii?q?7h/nTuqcIjd1iGh4dL6hhBu+60etxvD6W8KpylhFtDBFncPJtn0V1xzc9MyHSv?= =?us-ascii?q?xl80ekwzmP1gTT5vhKIEAxiKbXMpAhz7EtmpYJvkTDGSj2mEryjKCIbEkr5u+o?= =?us-ascii?q?6+H/brXnoJ+TKZN0hxngPqgynsGzG+c1PwgUU2SG5+ix16fv8ELkTLlSi/05iK?= =?us-ascii?q?jZsJTUJcQBoa65BhdY04k55BahDjepzs4YkWMDLF1bYhKHiIjoNkrBIPD9F/i/?= =?us-ascii?q?glCsnC13yPDBO73tGo/NIWTbkLf9YbZ97FZRxxYpwtBa45JYE7UBIPPoWk/tr9?= =?us-ascii?q?HYFR84Mwmsw+n9Etl914UeWXiOAqCDKq/Sv0WItaoTJLyHZJUUoyr6M/goz+Tn?= =?us-ascii?q?g3EwnVscO6S0jrUNb3XtLv14IkiDKV7hmNAQWTM6txQ/QfasrFCYVi97ZnCoXq?= =?us-ascii?q?t66CttW9HuNpvKWo342O/J5yy8BJADPjkbWGDJKm/hcsC/Y9lJaC+WJZU8wDkN?= =?us-ascii?q?VLzkVIp4kB/y7Un1zL1oKueS8Sod58q6hYpFotbLnBR3zgRaSsGU0mWDVWZxxz?= =?us-ascii?q?paSDo/3aQ5qkt4mA7ajfpIxsdAHNkW3MtnFx8gPMeEne18EdH7HAzbLI+E?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AyAgD06uBffymAVdFiHgEBCxIMhgYzL?= =?us-ascii?q?oRBgR6QCJQaiCcBAwENLwQBAYZBAh0HAQQ0EwIQAQEFAQEBAgEDAwQBEwEBDQs?= =?us-ascii?q?LCCeFdoI4IoMaAQQBEhEwJgULCwQHNwICIhIBBQEcGSKFayChR4EEPYs0gTKJO?= =?us-ascii?q?IFCEoEmhWESPIZ6Jg+BTT+BETaCYz6EHAEBbYJKgmAEgnh6X2oMTpAUJ6dgLAe?= =?us-ascii?q?BWYEegRsLhneTLyKiRrBjhG0QI4FKgXozGidMMQaCMlAZDZxrQzA3AgYBCQEBA?= =?us-ascii?q?wmLFgEB?= X-IPAS-Result: =?us-ascii?q?A0AyAgD06uBffymAVdFiHgEBCxIMhgYzLoRBgR6QCJQaiCc?= =?us-ascii?q?BAwENLwQBAYZBAh0HAQQ0EwIQAQEFAQEBAgEDAwQBEwEBDQsLCCeFdoI4IoMaA?= =?us-ascii?q?QQBEhEwJgULCwQHNwICIhIBBQEcGSKFayChR4EEPYs0gTKJOIFCEoEmhWESPIZ?= =?us-ascii?q?6Jg+BTT+BETaCYz6EHAEBbYJKgmAEgnh6X2oMTpAUJ6dgLAeBWYEegRsLhneTL?= =?us-ascii?q?yKiRrBjhG0QI4FKgXozGidMMQaCMlAZDZxrQzA3AgYBCQEBAwmLFgEB?= X-IronPort-AV: E=Sophos;i="5.78,437,1599516000"; d="scan'208,217";a="368286265" X-MGA-submission: =?us-ascii?q?MDF75OuUK3Tu7QKNO0PSUC62+JFnzW2HS28KrW?= =?us-ascii?q?zsp9BIfjlTrP0cLJ9ZmdA4NnhMDUUqklU6jjECmMFKWr8xiwHUFpgWOj?= =?us-ascii?q?mroaeTFQ37HR7LDbF+70vOUJE7D60OPmm1oLzE/1MQwDCiyM6MW9RByL?= =?us-ascii?q?MrsawKtISI8GQbTCUXmbfsFQ=3D=3D?= Received: from mail-wm1-f41.google.com ([209.85.128.41]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-GCM-SHA384; 21 Dec 2020 19:38:20 +0100 Received: by mail-wm1-f41.google.com with SMTP id r4so11905003wmh.5 for ; Mon, 21 Dec 2020 10:38:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UfHrhl2WEaX39wmsb/oZpoMFpX27K8LKRAO2A0Uz6p8=; b=qxyehZqhKrVmZ0WeNJVlAgdXa4i8oD0XEtuTYYVIL7OrqkH2BxY3SoqiVKFzu/s/q8 VfbqeHVcPbUELB2dPSd4tHlQPVzoUxRgTmXQQJ+G4AB4iMF8U5iq0WPpjAcmJMu7jbrC djO4o5/rgjsv0kmIqQaLRv4lXCz10gAYdD+xUD2uM8UM2qiYr+kLnBZFjalC/G8fwRET YhUkVPNNQG7LPnU+flv+cU4s0jo/T48RxhWKKbRJAcn+Zz3YYkWBSx25GAaV0VCsfQfD xYthkcqAFPawwHmGbPqzo0KQx3QQsqqsaxJOoKja9ARwnn+eDsjxb8/KsMevUBdYYFqp Ofgw== X-Gm-Message-State: AOAM5302/KnBt3X4W+FI6zK79cqGNd0mI2rjui1ZGTl3dj12ILure9VZ 1lTdQZ6d83yHNOGj23a0BgtcUsnunipwxd5X/SygrJe++ys= X-Google-Smtp-Source: ABdhPJwVncUsVRpaUv0eQ/youuBi81O6syCMjWS2ZbVetWCGVShcvKiviCg3GSmsmPfRAnDx01LdupfMk8sy9vsMkeI= X-Received: by 2002:a1c:bc02:: with SMTP id m2mr17803274wmf.59.1608575900343; Mon, 21 Dec 2020 10:38:20 -0800 (PST) MIME-Version: 1.0 References: <9AB7B536-D8D5-4473-8692-110F0053F2EE@raffalli.eu> In-Reply-To: <9AB7B536-D8D5-4473-8692-110F0053F2EE@raffalli.eu> From: Xavier Leroy Date: Mon, 21 Dec 2020 19:37:54 +0100 Message-ID: To: christophe@raffalli.eu Cc: caml users Content-Type: multipart/alternative; boundary="0000000000002260d405b6fdc3fc" Subject: Re: [Caml-list] Global roots Reply-To: Xavier Leroy X-Loop: caml-list@inria.fr X-Sequence: 18317 Errors-To: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --0000000000002260d405b6fdc3fc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Dec 20, 2020 at 8:57 PM 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. > 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=C3=A9 de mon appareil Android avec Courriel K-9 Mail. Veuillez excu= ser ma > bri=C3=A8vet=C3=A9. --0000000000002260d405b6fdc3fc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Dec 20, 2020 at 8:57 PM <christophe@raffalli.eu> wrote:
Hello,

May global roots be initial= ized to (value)NULL ?

Yes, in the defau= lt OCaml configuration as of today.

No, in the &qu= ot;no naked pointers" mode that was introduced in OCaml 4.02.0, made m= uch 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.


I have a multithreaded program, which segfau= lt in callback_asm, while I think I respect all rules of c interfaces... Ex= cept maybe the above...

There is an OPA= M compiler switch "4.10.0+nnpcheck" that adds run-time checks for= ill-formed values according to the no-naked-pointers rules.=C2=A0 Maybe yo= u could use it to rule out this potential problem.

Hope this helps,

- Xavier Leroy


Chevets,
Christ= ophe
--
Envoy=C3=A9 de mon appareil Android avec Courriel K-9 Mail. = Veuillez excuser ma bri=C3=A8vet=C3=A9.
--0000000000002260d405b6fdc3fc--