On Tue, Apr 06, 2010 at 08:35:13AM -0400, Greg Wooledge wrote:
> On Tue, Apr 06, 2010 at 02:21:05PM +0200, Roman Rakus wrote:
> > >>$((2 ** 63 / -1))
> 
> > I can reproduce it in 4.1.2(1)-release and 4.0.23(1)-release on x86_64 
> > GNU/Linux. I didn't try on bash 3.2.
> 
> cyclops:~$ uname -a; echo $BASH_VERSION
> OpenBSD cyclops.wooledge.org 4.6 GENERIC.MP#81 amd64
> 4.0.24(1)-release
> cyclops:~$ echo $((2 ** 63 / -1))
> Connection to cyclops closed.
> griffon:~$ 
> 
> An amd64-specific bug, then?  (The Linux box I tested on earlier is i386,
> and the HP-UX box is PA-RISC 2.0.)

On x86_64 I see:

 ~> echo $((2 ** 63 / -1))
 Floating exception

whereas on i686

 ~> echo $((2 ** 63 / -1))
 -9223372036854775808

... both GNU/Linux.  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.


       Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr


Reply via email to