[GHC] #10616: Panic in ghci debugger with PolyKinds and PhantomTypes

GHC ghc-devs at haskell.org
Wed Jul 8 14:56:20 UTC 2015


#10616: Panic in ghci debugger with PolyKinds and PhantomTypes
-------------------------------+-----------------------------------------
        Reporter:  bjmprice    |                   Owner:
            Type:  bug         |                  Status:  new
        Priority:  normal      |               Milestone:
       Component:  GHCi        |                 Version:  7.10.1
      Resolution:              |                Keywords:
Operating System:  Linux       |            Architecture:  x86_64 (amd64)
 Type of failure:  GHCi crash  |               Test Case:
      Blocked By:              |                Blocking:
 Related Tickets:              |  Differential Revisions:
-------------------------------+-----------------------------------------
Description changed by bjmprice:

Old description:

> The code
> {{{#!hs
> {-# LANGUAGE PolyKinds  #-}
>
> data D a = A | B
>
> f d at A = const True d
> f B = False
> }}}
> when loaded in ghci, runs fine without breakpoints, but panics when
> breaking on {{{f A}}}, thus:
> {{{
> *Main> f A
> True
> *Main> :break 5
> Breakpoint 0 activated at DebuggerCrash.hs:5:9-20
> *Main> f A
> ghc-stage2: panic! (the 'impossible' happened)
>   (GHC version 7.10.1 for x86_64-unknown-linux):
>         ASSERT failed! file compiler/typecheck/TcUnify.hs line 1138 k_amp
> }}}
>
> It is fine in 7.4.1 and 7.8.1.
> It panics in 7.10.1 and HEAD at d71b65f53a1daa2631d2c818c7ea6add77813532
>
> Without one (or both) of PolyKinds or the phantom type it runs fine.
>
> {{{uname -a: Linux cam-05-unx 3.5.0-54-generic #81~precise1-Ubuntu SMP
> Tue Jul 15 04:02:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux}}}
> {{{
> gcc -v:
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
> 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
> --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-
> suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib
> --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
> --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-
> nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
> --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
> --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic
> --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-
> gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
> }}}
>
> With {{{ghci-7.10.1 -v}}}
> {{{
> ghci-7.10.1 -v ./DebuggerCrash.hs
> GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
> Glasgow Haskell Compiler, Version 7.10.1, stage 2 booted by GHC version
> 7.8.2
> Using binary package database:
> /5playpen/t-bepric/ghc-7.10.1-build/inplace/lib/package.conf.d/package.cache
> wired-in package ghc-prim mapped to ghc-prim-0.4.0.0-inplace
> wired-in package integer-gmp mapped to integer-gmp-1.0.0.0-inplace
> wired-in package base mapped to base-4.8.0.0-inplace
> wired-in package rts mapped to builtin_rts
> wired-in package template-haskell mapped to template-
> haskell-2.10.0.0-inplace
> wired-in package ghc mapped to ghc-7.10.1-inplace
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> Hsc static flags:
> Loading package ghc-prim-0.4.0.0 ... linking ... done.
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/5playpen/t-bepric/ghc-7.10.1-build/libraries/integer-gmp2/dist-
> install/build --print-file-name libgmp.so
> Loading package integer-gmp-1.0.0.0 ... linking ... done.
> Loading package base-4.8.0.0 ... linking ... done.
> wired-in package ghc-prim mapped to ghc-prim-0.4.0.0-inplace
> wired-in package integer-gmp mapped to integer-gmp-1.0.0.0-inplace
> wired-in package base mapped to base-4.8.0.0-inplace
> wired-in package rts mapped to builtin_rts
> wired-in package template-haskell mapped to template-
> haskell-2.10.0.0-inplace
> wired-in package ghc mapped to ghc-7.10.1-inplace
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> *** Chasing dependencies:
> Chasing modules from:
> Stable obj: []
> Stable BCO: []
> unload: retaining objs []
> unload: retaining bcos []
> Ready for upsweep []
> Upsweep completely successful.
> *** Deleting temp files:
> Deleting:
> *** Chasing dependencies:
> Chasing modules from: *DebuggerCrash.hs
> Stable obj: []
> Stable BCO: []
> unload: retaining objs []
> unload: retaining bcos []
> Ready for upsweep
>   [NONREC
>       ModSummary {
>          ms_hs_date = 2015-07-08 14:18:11 UTC
>          ms_mod = Main,
>          ms_textual_imps = [import (implicit) Prelude]
>          ms_srcimps = []
>       }]
> *** Deleting temp files:
> Deleting:
> compile: input file DebuggerCrash.hs
> Created temporary directory: /tmp/ghc22370_0
> *** Checking old interface for Main:
> [1 of 1] Compiling Main             ( DebuggerCrash.hs, interpreted )
> *** Parser:
> *** Renamer/typechecker:
> *** Desugar:
> Result size of Desugar (before optimization)
>   = {terms: 16, types: 26, coercions: 0}
> Result size of Desugar (after optimization)
>   = {terms: 12, types: 18, coercions: 0}
> *** Simplifier:
> Result size of Simplifier iteration=1
>   = {terms: 12, types: 20, coercions: 0}
> Result size of Simplifier = {terms: 12, types: 20, coercions: 0}
> *** Tidy Core:
> Result size of Tidy Core = {terms: 12, types: 20, coercions: 0}
> *** CorePrep:
> Result size of CorePrep = {terms: 16, types: 30, coercions: 0}
> *** ByteCodeGen:
> Upsweep completely successful.
> *** Deleting temp files:
> Deleting: /tmp/ghc22370_0/ghc22370_2.c /tmp/ghc22370_0/ghc22370_1.o
> Warning: deleting non-existent /tmp/ghc22370_0/ghc22370_2.c
> Warning: deleting non-existent /tmp/ghc22370_0/ghc22370_1.o
> Ok, modules loaded: Main.
> *Main> f A
> *** Parser:
> *** Desugar:
> *** Simplify:
> *** CorePrep:
> *** ByteCodeGen:
> True
> *Main> :break 5
> Breakpoint 0 activated at DebuggerCrash.hs:5:9-20
> *Main> f A
> *** Parser:
> *** Desugar:
> *** Simplify:
> *** CorePrep:
> *** ByteCodeGen:
> ghc-stage2: panic! (the 'impossible' happened)
>   (GHC version 7.10.1 for x86_64-unknown-linux):
>         ASSERT failed! file compiler/typecheck/TcUnify.hs line 1138 k_amp
> }}}

New description:

 Potentially related: #10616 (I noticed that one first, and in simplifying
 the code it changed to this error - note TcUnify.hs vs TcType.hs)

 The code
 {{{#!hs
 {-# LANGUAGE PolyKinds  #-}

 data D a = A | B

 f d at A = const True d
 f B = False
 }}}
 when loaded in ghci, runs fine without breakpoints, but panics when
 breaking on {{{f A}}}, thus:
 {{{
 *Main> f A
 True
 *Main> :break 5
 Breakpoint 0 activated at DebuggerCrash.hs:5:9-20
 *Main> f A
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.10.1 for x86_64-unknown-linux):
         ASSERT failed! file compiler/typecheck/TcUnify.hs line 1138 k_amp
 }}}

 It is fine in 7.4.1 and 7.8.1.
 It panics in 7.10.1 and HEAD at d71b65f53a1daa2631d2c818c7ea6add77813532

 Without one (or both) of PolyKinds or the phantom type it runs fine.

 {{{uname -a: Linux cam-05-unx 3.5.0-54-generic #81~precise1-Ubuntu SMP Tue
 Jul 15 04:02:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux}}}
 {{{
 gcc -v:
 Using built-in specs.
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
 Target: x86_64-linux-gnu
 Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
 --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-
 suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib
 --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
 --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls
 --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-
 libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-
 objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-
 checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
 --target=x86_64-linux-gnu
 Thread model: posix
 gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
 }}}

 With {{{ghci-7.10.1 -v}}}
 {{{
 ghci-7.10.1 -v ./DebuggerCrash.hs
 GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
 Glasgow Haskell Compiler, Version 7.10.1, stage 2 booted by GHC version
 7.8.2
 Using binary package database:
 /5playpen/t-bepric/ghc-7.10.1-build/inplace/lib/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-prim-0.4.0.0-inplace
 wired-in package integer-gmp mapped to integer-gmp-1.0.0.0-inplace
 wired-in package base mapped to base-4.8.0.0-inplace
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.10.0.0-inplace
 wired-in package ghc mapped to ghc-7.10.1-inplace
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 Hsc static flags:
 Loading package ghc-prim-0.4.0.0 ... linking ... done.
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/5playpen/t-bepric/ghc-7.10.1-build/libraries/integer-gmp2/dist-
 install/build --print-file-name libgmp.so
 Loading package integer-gmp-1.0.0.0 ... linking ... done.
 Loading package base-4.8.0.0 ... linking ... done.
 wired-in package ghc-prim mapped to ghc-prim-0.4.0.0-inplace
 wired-in package integer-gmp mapped to integer-gmp-1.0.0.0-inplace
 wired-in package base mapped to base-4.8.0.0-inplace
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.10.0.0-inplace
 wired-in package ghc mapped to ghc-7.10.1-inplace
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 *** Chasing dependencies:
 Chasing modules from:
 Stable obj: []
 Stable BCO: []
 unload: retaining objs []
 unload: retaining bcos []
 Ready for upsweep []
 Upsweep completely successful.
 *** Deleting temp files:
 Deleting:
 *** Chasing dependencies:
 Chasing modules from: *DebuggerCrash.hs
 Stable obj: []
 Stable BCO: []
 unload: retaining objs []
 unload: retaining bcos []
 Ready for upsweep
   [NONREC
       ModSummary {
          ms_hs_date = 2015-07-08 14:18:11 UTC
          ms_mod = Main,
          ms_textual_imps = [import (implicit) Prelude]
          ms_srcimps = []
       }]
 *** Deleting temp files:
 Deleting:
 compile: input file DebuggerCrash.hs
 Created temporary directory: /tmp/ghc22370_0
 *** Checking old interface for Main:
 [1 of 1] Compiling Main             ( DebuggerCrash.hs, interpreted )
 *** Parser:
 *** Renamer/typechecker:
 *** Desugar:
 Result size of Desugar (before optimization)
   = {terms: 16, types: 26, coercions: 0}
 Result size of Desugar (after optimization)
   = {terms: 12, types: 18, coercions: 0}
 *** Simplifier:
 Result size of Simplifier iteration=1
   = {terms: 12, types: 20, coercions: 0}
 Result size of Simplifier = {terms: 12, types: 20, coercions: 0}
 *** Tidy Core:
 Result size of Tidy Core = {terms: 12, types: 20, coercions: 0}
 *** CorePrep:
 Result size of CorePrep = {terms: 16, types: 30, coercions: 0}
 *** ByteCodeGen:
 Upsweep completely successful.
 *** Deleting temp files:
 Deleting: /tmp/ghc22370_0/ghc22370_2.c /tmp/ghc22370_0/ghc22370_1.o
 Warning: deleting non-existent /tmp/ghc22370_0/ghc22370_2.c
 Warning: deleting non-existent /tmp/ghc22370_0/ghc22370_1.o
 Ok, modules loaded: Main.
 *Main> f A
 *** Parser:
 *** Desugar:
 *** Simplify:
 *** CorePrep:
 *** ByteCodeGen:
 True
 *Main> :break 5
 Breakpoint 0 activated at DebuggerCrash.hs:5:9-20
 *Main> f A
 *** Parser:
 *** Desugar:
 *** Simplify:
 *** CorePrep:
 *** ByteCodeGen:
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.10.1 for x86_64-unknown-linux):
         ASSERT failed! file compiler/typecheck/TcUnify.hs line 1138 k_amp
 }}}

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10616#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list