Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: SIGFPE crash
- X-seq: zsh-workers 29180
- From: Jon Mayo <jon.mayo@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: SIGFPE crash
- Date: Sat, 7 May 2011 15:19:43 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=fSMa7bTZX3dd5qEFEmmEqgp3d/HmnuL0v5TLItBN/uY=; b=Y3DB9EUMQD8Z0HwqgQbMcn0zLk+0tjFRdUlBsXBOwHZuu2CjZJ0EdcSOpZogNzdy0R oWqPijo/F1W6cUgSiWkIm5sgTdWXxfK84ZsSWjCq2g/itlqJbdFMUq7jF1Kz25ubtAM0 jBx8wkTcWDePaRu3PKsq+IAmfYYQ8whUsUY0w=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=FZPGTEWCoqlkAeLLt3EQpxo6zpAGLhjyFz3yfKSFLUOBq7fqvn6zTJMV9fJ2GMpAX5 V/X97VeW+NueuuQrLPbaZpaRpNvylwAsN1n0fK59fELN0ti3Lz5jiK7MeVFifhPox1NJ IoVSM/VhnPV95ct1+Wa2hEiJ3gcPcHOMual8c=
- In-reply-to: <BANLkTimCMEy1_EPe00dX7yhi-9EqDzKaMA@mail.gmail.com>
- 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: <BANLkTi=x2Cn3dZFGaEdVUm9+4mAse+dQsQ@mail.gmail.com> <BANLkTimCMEy1_EPe00dX7yhi-9EqDzKaMA@mail.gmail.com>
On Sat, May 7, 2011 at 3:17 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 7 May 2011 23:56, Jon Mayo <jon.mayo@xxxxxxxxx> wrote:
>> echo $[-9223372036854775808/-1]
>>
>> this causes zsh to exit immediately with an FPE. Does anyone have a
>> patch to fix this?
>
> diff --git a/Src/math.c b/Src/math.c
> index 35b362d..3c08052 100644
> --- a/Src/math.c
> +++ b/Src/math.c
> @@ -1053,8 +1053,12 @@ op(int what)
> return;
> if (c.type == MN_FLOAT)
> c.u.d = a.u.d / b.u.d;
> - else
> - c.u.l = a.u.l / b.u.l;
> + else {
> + if (a.u.l == LONG_MIN && b.u.l == -1)
should be LLONG_MIN
> + c.u.l = 0;
LLONG_MAX would be the closest answer, but 1 off. I would switch it
from integer to double type in this case, but that might be difficult.
> + else
> + c.u.l = a.u.l / b.u.l;
> + }
> break;
> case MOD:
> case MODEQ:
>
>
> Do we want to print a warning and/or use another value than 0 in this case?
>
> --
> Mikael Magnusson
>
-- Jon
Messages sorted by:
Reverse Date,
Date,
Thread,
Author