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 p04HN1cD014506 for ; Tue, 4 Jan 2011 18:23:01 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsQAAEbmIk1KfVO2hmdsb2JhbACDd6A9CBUBAQEKCwoHFSCkZok7glSFF4ZDAQEDBYEbgzZ0BIsHiUE X-IronPort-AV: E=Sophos;i="4.60,273,1291590000"; d="scan'208";a="93809043" Received: from mail-pv0-f182.google.com ([74.125.83.182]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Jan 2011 18:22:55 +0100 Received: by pvc22 with SMTP id 22so3212400pvc.27 for ; Tue, 04 Jan 2011 09:22:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=QEb0NdWuSsbi52jLv7xnOwNZfgoOoAlfMqUvb3ZXdKI=; b=c5wGxYUlVOUUH9nrA7vs0bEY+/SumTNhsOj1tE+OH/wI3B64iA2YaX0GpZELmK/25L 7BiwH64/9MkXVUEafR/sD1nDN+Q+gZFcHK58xhDjg20cTkyHRK8ZoZUDFr7nT/263nfv X8TPzSIhL1tX7lHrYb1zmluL9XyrgCUox7R4M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=b7FLn9CpgXmG7rSG6jhvLkUJ6zhPcgdR4u4kno8oDEsjGdH/bR6gh8WvkzFF99vFcY kK4XBbVKjOL3b2+Rr+c5ateiM+BBmPs0y11NOdKJSMhAE5/092GKPc9keMsA9DZly958 X3/xOyILiwUEfTKnf7bI1nFOCbUitNX5kWROQ= MIME-Version: 1.0 Received: by 10.143.27.29 with SMTP id e29mr18115688wfj.336.1294161774524; Tue, 04 Jan 2011 09:22:54 -0800 (PST) Sender: daniel.c.buenzli@gmail.com Received: by 10.142.89.17 with HTTP; Tue, 4 Jan 2011 09:22:54 -0800 (PST) In-Reply-To: References: <4D23353C.8020803@gmail.com> Date: Tue, 4 Jan 2011 18:22:54 +0100 X-Google-Sender-Auth: qBh9LsCd8miQ4SAMby2SuXChf9E Message-ID: From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: Jean Krivine Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Array.make exception and parser > So the bug is not really mine. Of course it's not. > An easy "patch" would be to define a Parsing.Overflow exception to throw > whenever the function grow_stack() fails... If you mean catching Invalid_argument and raising Overflow then no. What needs to be done is to raise Overflow when you are about to call Array.make with a a value greater than Sys.max_array_length. Again, Invalid_argument exceptions are programming errors (here a programming error of the Parsing module). Code catching Invalid_argument to implement an algorithm is unsound. The only place where you should catch Invalid_argument is at the toplevel of your program to report the stack trace. One obvious way of understanding that is to see what is raised on out of bounds access and consider the -unsafe compiler option. Daniel P.S. Btw if you want that to be fixed you should file a bug report.