From: "Jérémie Roquet" <arkanosis@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: prevent SIGFPE on systems where LONG_MIN < -LONG_MAX
Date: Mon, 3 Sep 2012 17:08:18 +0200 [thread overview]
Message-ID: <CAFOazAMaw7OzxcsH=KYCE61JrY+U25ouubXXyc2Hpor3DSSREg@mail.gmail.com> (raw)
In-Reply-To: <20120903155732.6e0ed125@pwslap01u.europe.root.pri>
2012/9/3 Mikael Magnusson <mikachu@gmail.com>:
> 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@csr.com>:
> 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
next prev parent reply other threads:[~2012-09-03 15:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 14:32 Jérémie Roquet
2012-09-03 14:40 ` Mikael Magnusson
2012-09-03 14:57 ` Peter Stephenson
2012-09-03 15:08 ` Jérémie Roquet [this message]
2012-09-03 16:26 ` Vincent Lefevre
2012-09-04 18:26 ` Peter Stephenson
2012-09-04 23:50 ` Vincent Lefevre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFOazAMaw7OzxcsH=KYCE61JrY+U25ouubXXyc2Hpor3DSSREg@mail.gmail.com' \
--to=arkanosis@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).