Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX
- X-seq: zsh-workers 30653
- From: Jérémie Roquet <arkanosis@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX
- Date: Mon, 3 Sep 2012 17:08:18 +0200
- 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==
- In-reply-to: <20120903155732.6e0ed125@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAFOazAPwkJ25FDNL--AtCFLFK2CWKHiOCyCJudx3qgK7LKcDGg@mail.gmail.com> <CAHYJk3RU_DubPO+gcuSxW3qh6Oc2sshDC0=swbQh5t+p+8fckg@mail.gmail.com> <20120903155732.6e0ed125@pwslap01u.europe.root.pri>
2012/9/3 Mikael Magnusson <mikachu@xxxxxxxxx>:
> 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 <Peter.Stephenson@xxxxxxx>:
> So what's the answer, then? Jérémie'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 == 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 == -LONG_MAX, the shell should not raise a warning.
Best regards,
--
Jérémie
Messages sorted by:
Reverse Date,
Date,
Thread,
Author