From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15503 invoked by alias); 3 Sep 2012 15:08:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30653 Received: (qmail 2956 invoked from network); 3 Sep 2012 15:08:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) 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 :content-type:content-transfer-encoding; bh=hp597u+pGVwS/JM+YBE6SGqvjAzTz4Uf550xhxB44U0=; b=OEseFjONo0VGbGlDQbIlop/4IEl5FzeALT0xDwEOy3NGdlldpiQ9HDR/XKooF4etpZ 5u/8avY/27tC4QKE5SBR2ZmoSpyrJhKzT3OFvhBifYyxRLAy3cSHVFl7jkr8Pk5tgpMs 3ZPbyN70Cf1XIzDe3fiwIXF8sZqG4TBYVBzjCv9vf3FE3PwC6KDZi/Eaz+brF+bDgZjz twxMQ7auvQPKXvqhfaT23t8FGow/SUeKOhwrYFeUba7D/nU4sWPXJc5SXZqAOlWLnJEX 6wkjw+0KEyIObWURoGJCbgZYfhQi09WIHS5EvT4o+mPRu4VNI91GP9QwTZ1+lEKT0Csm 7SKA== MIME-Version: 1.0 In-Reply-To: <20120903155732.6e0ed125@pwslap01u.europe.root.pri> References: <20120903155732.6e0ed125@pwslap01u.europe.root.pri> From: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Date: Mon, 3 Sep 2012 17:08:18 +0200 Message-ID: Subject: Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX To: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2012/9/3 Mikael Magnusson : > See also this thread, > http://www.zsh.org/mla/workers/2011/msg00613.html Thanks. I think we want a warning, as we have for division by zero. The shell should not crash, neither should it return incorrect results. The patch should work whatever the underlying type behind zlong is. 2012/9/3 Peter Stephenson : > So what's the answer, then? J=C3=A9r=C3=A9mie's patch makes only limited > assumptions; I think the #if is there simply to see if we can assume > two's complement arithmetic (it seems the preprocessor isn't keen on > "#if LONG_MIN - 1 =3D=3D LONG_MAX", I suppose it's not required to use > "long" precision) in which case the test should work. It might not > cover all real cases, but that's a lesser evil. Testing LONG_MIN < -LONG_MAX tells if the opposite of the minimal long value is a representable value. It makes the assumption that the answer is valid for ZSH_64_BIT_TYPE too. On systems where LONG_MIN =3D=3D -LONG_MAX, the shell should not raise a wa= rning. Best regards, --=20 J=C3=A9r=C3=A9mie