[GHC] #12136: SIGABRT on right-shift operation against long negative integer

#12136: SIGABRT on right-shift operation against long negative integer
--------------------------------------+----------------------------------
Reporter: khibino | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 7.10.3
Keywords: | Operating System: Linux
Architecture: x86_64 (amd64) | Type of failure: Runtime crash
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
--------------------------------------+----------------------------------
When the code like bellow is executed, the '''shiftR''' call causes
SIGABRT.
c128.hs
{{{#!hs
import Data.Bits
x:: Integer
x = 1 - (1 `shiftL` (128 + 64))
main :: IO ()
main = print $ x `shiftR` 128
}}}
I make this report using examples in GHC 7.10.3,
and I found the same problem in GHC 8.0.1 too.
backtrace using GDB
{{{
% ghc -O0 c128.hs
[1 of 1] Compiling Main ( c128.hs, c128.o )
Linking c128 ...
% gdb ./c128
GNU gdb (Debian 7.10-1+b1) 7.10
...
Reading symbols from ./c128...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/hibi/src/haskell/crash/Haskell/c128
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGABRT, Aborted.
0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
55 ../sysdeps/unix/sysv/linux/raise.c: そのようなファイルやディレクト
リはありません.
(gdb) bt
#0 0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff6ed58fa in __GI_abort () at abort.c:89
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
#3 0x000000000046e004 in salz_info ()
#4 0x0000000000000000 in ?? ()
(gdb) frame 2
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
(gdb) disas
Dump of assembler code for function integer_gmp_mpn_rshift_2c:
0x0000000000471630 <+0>: push %r13
...
0x00000000004716d8 <+168>: jne 0x4716c0

#12136: SIGABRT on right-shift operation against long negative integer -----------------------------------+-------------------------------------- Reporter: khibino | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Core Libraries | Version: 7.10.3 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -----------------------------------+-------------------------------------- Changes (by thomie): * cc: hvr (added) * priority: normal => high Comment: Works fine in 7.6.3 and 7.8.4, printing `-18446744073709551616`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12136#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12136: SIGABRT on right-shift operation against long negative integer
-----------------------------------+--------------------------------------
Reporter: khibino | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Core Libraries | Version: 7.10.3
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-----------------------------------+--------------------------------------
Description changed by khibino:
@@ -17,1 +17,1 @@
- and I found the same problem in GHC 8.0.1 too.
+ and I found the same problem in '''GHC 8.0.1''' too.
New description:
When the code like bellow is executed, the '''shiftR''' call causes
SIGABRT.
c128.hs
{{{#!hs
import Data.Bits
x:: Integer
x = 1 - (1 `shiftL` (128 + 64))
main :: IO ()
main = print $ x `shiftR` 128
}}}
I make this report using examples in GHC 7.10.3,
and I found the same problem in '''GHC 8.0.1''' too.
backtrace using GDB
{{{
% ghc -O0 c128.hs
[1 of 1] Compiling Main ( c128.hs, c128.o )
Linking c128 ...
% gdb ./c128
GNU gdb (Debian 7.10-1+b1) 7.10
...
Reading symbols from ./c128...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/hibi/src/haskell/crash/Haskell/c128
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGABRT, Aborted.
0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
55 ../sysdeps/unix/sysv/linux/raise.c: そのようなファイルやディレクト
リはありません.
(gdb) bt
#0 0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff6ed58fa in __GI_abort () at abort.c:89
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
#3 0x000000000046e004 in salz_info ()
#4 0x0000000000000000 in ?? ()
(gdb) frame 2
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
(gdb) disas
Dump of assembler code for function integer_gmp_mpn_rshift_2c:
0x0000000000471630 <+0>: push %r13
...
0x00000000004716d8 <+168>: jne 0x4716c0

#12136: SIGABRT on right-shift operation against long negative integer
-----------------------------------+--------------------------------------
Reporter: khibino | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Core Libraries | Version: 8.0.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-----------------------------------+--------------------------------------
Changes (by khibino):
* version: 7.10.3 => 8.0.1
@@ -16,1 +16,1 @@
- I make this report using examples in GHC 7.10.3,
+ I make this report using examples in '''GHC 7.10.3''',
New description:
When the code like bellow is executed, the '''shiftR''' call causes
SIGABRT.
c128.hs
{{{#!hs
import Data.Bits
x:: Integer
x = 1 - (1 `shiftL` (128 + 64))
main :: IO ()
main = print $ x `shiftR` 128
}}}
I make this report using examples in '''GHC 7.10.3''',
and I found the same problem in '''GHC 8.0.1''' too.
backtrace using GDB
{{{
% ghc -O0 c128.hs
[1 of 1] Compiling Main ( c128.hs, c128.o )
Linking c128 ...
% gdb ./c128
GNU gdb (Debian 7.10-1+b1) 7.10
...
Reading symbols from ./c128...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/hibi/src/haskell/crash/Haskell/c128
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGABRT, Aborted.
0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
55 ../sysdeps/unix/sysv/linux/raise.c: そのようなファイルやディレクト
リはありません.
(gdb) bt
#0 0x00007ffff6ed4478 in __GI_raise (sig=sig@entry=6) at
../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff6ed58fa in __GI_abort () at abort.c:89
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
#3 0x000000000046e004 in salz_info ()
#4 0x0000000000000000 in ?? ()
(gdb) frame 2
#2 0x00000000004716df in integer_gmp_mpn_rshift_2c ()
(gdb) disas
Dump of assembler code for function integer_gmp_mpn_rshift_2c:
0x0000000000471630 <+0>: push %r13
...
0x00000000004716d8 <+168>: jne 0x4716c0

#12136: SIGABRT on right-shift operation against long negative integer -----------------------------------+-------------------------------------- Reporter: khibino | Owner: Type: bug | Status: patch Priority: high | Milestone: Component: Core Libraries | Version: 8.0.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D2998 Wiki Page: | -----------------------------------+-------------------------------------- Changes (by nakaji_dayo): * status: new => patch * differential: => D2998 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12136#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12136: SIGABRT on right-shift operation against long negative integer
-----------------------------------+--------------------------------------
Reporter: khibino | Owner:
Type: bug | Status: patch
Priority: high | Milestone:
Component: Core Libraries | Version: 8.0.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): D2998
Wiki Page: |
-----------------------------------+--------------------------------------
Comment (by Ben Gamari

#12136: SIGABRT on right-shift operation against long negative integer -----------------------------------+-------------------------------------- Reporter: khibino | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D2998 Wiki Page: | -----------------------------------+-------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12136#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12136: SIGABRT on right-shift operation against long negative integer -----------------------------------+-------------------------------------- Reporter: khibino | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D2998 Wiki Page: | -----------------------------------+-------------------------------------- Comment (by khibino): Is this fix merged into ghc-8.0.3? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12136#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12136: SIGABRT on right-shift operation against long negative integer -----------------------------------+-------------------------------------- Reporter: khibino | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Core Libraries | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D2998 Wiki Page: | -----------------------------------+-------------------------------------- Comment (by bgamari): I'm afraid there likely will not be a 8.0.3 release nor is this patch on the `ghc-8.0` branch. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12136#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC