bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bash-bug] Can arithmetic evaluation trap more than just division by


From: Andreas Schwab
Subject: Re: [bash-bug] Can arithmetic evaluation trap more than just division by zero?
Date: Tue, 06 Apr 2010 15:59:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

"Dr. Werner Fink" <werner@suse.de> writes:

> On x86_64 the gdb shows:
>
>  Program received signal SIGFPE, Arithmetic exception.
>  0x0000000000462cd5 in exp2 () at expr.c:761
>  761             val1 /= val2;
>  (gdb) print val1
>  $1 = -9223372036854775808
>  (gdb) print val2
>  $2 = -1
>
> which is strange.

Not at all.  Overflow invokes undefined behaviour.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]