From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id CE7DE7EE1A for ; Fri, 30 Nov 2012 14:21:25 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.182 as permitted sender) identity=mailfrom; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f182.google.com) identity=helo; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ie0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEBAGWyuFDRVd+2mGdsb2JhbABEwAYIFg4BAQEBAQgJDQcUJ4IeAQEFQAEbHQEDDAYFCw0uIgERAQUBHAYTCId1AQMPoQ2MM4J6hQYKGScNWYh1AQUMjDSEQQOSToMyjmQWKYQU X-IronPort-AV: E=Sophos;i="4.84,191,1355094000"; d="scan'208";a="183978768" Received: from mail-ie0-f182.google.com ([209.85.223.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 30 Nov 2012 14:21:23 +0100 Received: by mail-ie0-f182.google.com with SMTP id s9so1064962iec.27 for ; Fri, 30 Nov 2012 05:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=bttxRXYTpM4nH9wUd0w9Mo1csq9pEtcvjhPXW3tjoNk=; b=JH57NPCD9s1v2LGCTGZpMqI/bqIsbELf3cOpHL91+NSCayFTYCFnwD8MXQ8sXkZFGf VZFqvDi5RSf/xx9N2EjnWAc0vqQAzZ/qoj8VSY+OK3+Qv217MsfLL5BvXx3dh4nU89th yeAkGjB6ZCxSo3q1SL5lXe/1GQzRcbLDFDeehzk7IRu2slWKUwDNGKwq+yiuH97NbJMk exdxDy8HaK3BEG/1+ukoy36xEnGCJe2Fq9B2LpizoLAC1B1FKPCoAe76VRjB8iaiFXna +k7yhuSlRhj6c3p2GvK1l/WgqbHdyyWfmLegtVy6KdAMie7af2hiPvNelRF181Sn24Mw UOQg== Received: by 10.50.173.34 with SMTP id bh2mr917371igc.70.1354281682758; Fri, 30 Nov 2012 05:21:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.184.199 with HTTP; Fri, 30 Nov 2012 05:20:42 -0800 (PST) In-Reply-To: <50B8AB75.5030508@univ-savoie.fr> References: <87625rhu04.fsf@golf.niidar.ru> <50B8AB75.5030508@univ-savoie.fr> From: Gabriel Scherer Date: Fri, 30 Nov 2012 14:20:42 +0100 Message-ID: To: Christophe Raffalli Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] ocamlc, ocamlopt stackoverflow on list My (entirely personal) understanding of the matter is that making every part of the compiler tail-recursive is a pain in the ass, and the kind of issues that never really stop happening (fix some case and the stack will blow somewhere else). Given the potential decrease of readability=B9 that such changes may incur, there is even less incentive to accept fixes on these issues. =B9: and eventual decrease of performance on small inputs, even if that is less important in the compiler code I would therefore suggest changing the generated code to look like the following (modulo order-of-evaluation issues): let li =3D 29000::29001::...::[] in let li =3D 28000::28001::...::li in ... let li =3D 0::1::2::...::li in li Remark: if the list is "quadratically too long", you may still segfault because of the excessive nesting of (let .. in ..) in this code. I'm unsure this could happen with a reasonable lower bound on permitted stack usage, but this could be fixed as well with another level of splitting: let li =3D (let li =3D ... in let li =3D ... in ... li) in let li =3D ( ... ) in ... On Fri, Nov 30, 2012 at 1:49 PM, Christophe Raffalli wrote: > > On my machine (ocaml 3.12.1 on linux 64 bits) with unlimited stack, > ocamlc and ocamlopt fails to compile a list constant of length 30000 > which is a problem in code generated by another program.