On Wed, Mar 27, 2013 at 04:27:22PM -0700, Matthew Dempsky wrote: > On Wed, Mar 27, 2013 at 4:15 PM, Nicholas Marriott > <nicholas.marri...@gmail.com> wrote: > > Sure, that actually looks to be what other shells do anyhow. > > That looks ok to me. > > Which shells did you check, out of curiosity? On Goobuntu, both bash > and dash give SIGFPE too actually.
Bash on Ubuntu (4.2.37) plus bash (4.2.45) and zsh (5.0.0) from our ports. > > Checking POSIX, I notice that it requires that shell semantics match > the C language semantics, but then C semantics for LONG_MIN / -1 and > LONG_MIN % -1 appear to be undefined*... so there's nothing to match > really. > > (* The glibc manual claims C requires "LONG_MIN % -1" to evaluate to > 0, but my reading of C11 6.5.5.6 says since LONG_MIN / -1 is not > representable, that the behavior of LONG_MIN % -1 is undefined.)