From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8TH3aXb010679 for ; Thu, 29 Sep 2011 19:03:38 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmYCAJKjhE4SCRkPm2dsb2JhbABBqA8UAQEBAQEICQsJFCWBUwEBBAEnUgULC0ZXBhOHerAOiQGHEwSlLA X-IronPort-AV: E=Sophos;i="4.68,462,1312149600"; d="scan'208";a="122180833" Received: from dmz-mailsec-scanner-4.mit.edu ([18.9.25.15]) by mail1-smtp-roc.national.inria.fr with ESMTP; 29 Sep 2011 19:03:37 +0200 X-AuditID: 1209190f-b7f6e6d0000008df-06-4e84a4e775f5 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id FD.15.02271.7E4A48E4; Thu, 29 Sep 2011 13:03:35 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p8TH3ZRB031984; Thu, 29 Sep 2011 13:03:35 -0400 Received: from localhost (CONTENTS-VNDER-PRESSVRE.MIT.EDU [18.9.64.11]) (authenticated bits=0) (User authenticated as jfc@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p8TH3YXM021785; Thu, 29 Sep 2011 13:03:35 -0400 (EDT) Message-Id: <201109291703.p8TH3YXM021785@outgoing.mit.edu> To: Xavier Leroy cc: caml-list In-reply-to: <4E849E44.3050002@inria.fr> References: <201109291603.p8TG3FBX006930@outgoing.mit.edu> <4E849E44.3050002@inria.fr> Comments: In-reply-to Xavier Leroy message dated "Thu, 29 Sep 2011 18:35:16 +0200." X-Mailer: MH-E 8.2; nmh 1.3; GNU Emacs 23.1.1 Date: Thu, 29 Sep 2011 13:03:34 -0400 From: John Carr X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRmVeSWpSXmKPExsUixG6novt8SYufwb5WXYtPOzawWLzfPJ3V gclj0otDLAGMUVw2Kak5mWWpRfp2CVwZHWt+sxds5Km4friVtYHxJGcXIyeHhICJxNWHb1kg bDGJC/fWs3UxcnEICexjlDi4fhYzhLOBUeJI70tGCKeBSeLR2lesIC28AlYSPzo2g7WLCGhI vLp+iw3EZhZQkvi4u4MZxBYW8JX4s3gXWJwTqGbF+ZVg9UICYRJdHX9YIerzJV6e+sIKcYau xMdFM9lBbBYBVYnrr+6A2WwCshKP2rsYJzDyL2BkWMUom5JbpZubmJlTnJqsW5ycmJeXWqRr opebWaKXmlK6iREUQJyS/DsYvx1UOsQowMGoxMP7I6nZT4g1say4MvcQoyQHk5Io77nFLX5C fEn5KZUZicUZ8UWlOanFhxglOJiVRHjj2oByvCmJlVWpRfkwKWkOFiVx3sYdDn5CAumJJanZ qakFqUUwWRkODiUJXj5gpAgJFqWmp1akZeaUIKSZODhBhvMADb8Jspi3uCAxtzgzHSJ/ilFR SpxXGKRZACSRUZoH1wuL8FeM4kCvCPOyglTxAJMDXPcroMFMQIO/FjaCDC5JREhJNTD2BdWc 3dC7/KXiqrSVWkf8XFurnv65/dT0oILr0jtn2Tq69kvviAssDWU4HajUEl4c0RS0PNQ1bXEr 6/wJdzvfJMbuCdHUW1ZZocQi8PvFiQz5yGu612tcOnPdi1RV5IK5UhlkAgwfLlqQ91WR7+Ae s9UBLUqqky8/iOD+U3b7xNXDvyWCgDqLMxINtZiLihMBCWw/2ssCAAA= Subject: Re: [Caml-list] Strange crash after switching to first class modules Xavier Leroy wrote: > Could you first try to eliminate that partial application of fprintf? > (Inline f at point of call, or eta-expand yourself.) The Printf > module takes a lot of liberties with the type system (ahem), so it is > one of the usual suspects in such a case. The program still crashes if I eta expand. But it has a different stack trace due to different tail calls and I think I understand the problem: Unpacking a module to provide a functor argument does not permute fields to match the required signature. I have a module that I use to represent another module plus another bit of information paired with the base type of the other module. module M : C with type t = t1 * t2 = struct type t = t1 * t2 let format chan (a,b) = ... (* format first part then second part *) and f1 (a1,b1) (a2,b2) = ... and f2 (a1,b1) (a2,b2) = ... and equal (a1,b1) (a2,b2) = ... and hash (a1,b2) = ... end This module, packed into a value and unpacked, is the argument to the Hashtbl.Make functor. The stack trace goes from Hashtbl.MakeSeeded.mem -> M.format -> another format function -> crash Hashtbl.mem doesn't call the format method because there is no format type in the functor argument. It calls equal. It reads the first value in the module expecting an equal method and finding something else. I think the module value is not being reformatted to the type expected by Hashtbl.Make. Is this enough of a clue or do you want me to try cutting it down to a smaller example?