[GHC] #10279: panic on haskell-src-exts

GHC ghc-devs at haskell.org
Fri Nov 27 14:35:06 UTC 2015


#10279: panic on haskell-src-exts
-------------------------------------+-------------------------------------
        Reporter:  throwaway123      |                Owner:  ezyang
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Template Haskell  |              Version:  7.10.1
      Resolution:  wontfix           |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Compile-time      |  (amd64)
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1342
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * status:  patch => closed
 * resolution:   => wontfix


Old description:

> Compiling `Bug.hs`:
>
> {{{
> {-# LANGUAGE QuasiQuotes #-}
>
> import Language.Haskell.Exts.QQ (dec)
>
> main :: IO ()
> main = return ()
>   where
>     foo = [dec| bar = 3 |]
> }}}
> by `ghc --make -v -dcore-lint Bug.hs` gives
> {{{
> ghc --make -v -dcore-lint Bug.hs
> Glasgow Haskell Compiler, Version 7.10.1, stage 2 booted by GHC version
> 7.8.4
> Using binary package database:
> /usr/lib/ghc-7.10.1/package.conf.d/package.cache
> wired-in package ghc-prim mapped to ghc-
> prim-0.4.0.0-7c945cc0c41d3b7b70f3edd125671166
> wired-in package integer-gmp mapped to integer-
> gmp-1.0.0.0-3c947e5fb6dca14804d9b2793c521b67
> wired-in package base mapped to
> base-4.8.0.0-1b689eb8d72c4d4cc88f445839c1f01a
> wired-in package rts mapped to builtin_rts
> wired-in package template-haskell mapped to template-
> haskell-2.10.0.0-e895139a0ffff267d412e3d0191ce93b
> wired-in package ghc mapped to
> ghc-7.10.1-325809317787a897b7a97d646ceaa3a3
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> Hsc static flags:
> wired-in package ghc-prim mapped to ghc-
> prim-0.4.0.0-7c945cc0c41d3b7b70f3edd125671166
> wired-in package integer-gmp mapped to integer-
> gmp-1.0.0.0-3c947e5fb6dca14804d9b2793c521b67
> wired-in package base mapped to
> base-4.8.0.0-1b689eb8d72c4d4cc88f445839c1f01a
> wired-in package rts mapped to builtin_rts
> wired-in package template-haskell mapped to template-
> haskell-2.10.0.0-e895139a0ffff267d412e3d0191ce93b
> wired-in package ghc mapped to
> ghc-7.10.1-325809317787a897b7a97d646ceaa3a3
> wired-in package dph-seq not found.
> wired-in package dph-par not found.
> *** Chasing dependencies:
> Chasing modules from: *Bug.hs
> Stable obj: []
> Stable BCO: []
> Ready for upsweep
>   [NONREC
>       ModSummary {
>          ms_hs_date = 2015-04-09 10:01:43.312180074 UTC
>          ms_mod = Main,
>          ms_textual_imps = [import (implicit) Prelude,
>                             import Language.Haskell.Exts.QQ ( dec )]
>          ms_srcimps = []
>       }]
> *** Deleting temp files:
> Deleting:
> compile: input file Bug.hs
> Created temporary directory: /tmp/ghc7356_0
> *** Checking old interface for Main:
> [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
> *** Parser:
> *** Renamer/typechecker:
> *** Simplify:
> *** CorePrep:
> *** ByteCodeGen:
> Loading package ghc-prim-0.4.0.0 ... linking ... done.
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/usr/lib/ghc-7.10.1/integ_2aU3IZNMF9a7mQ0OzsZ0dS --print-file-name
> libgmp.so
> Loading package integer-gmp-1.0.0.0 ... linking ... done.
> Loading package base-4.8.0.0 ... linking ... done.
> Loading package array-0.5.1.0 ... linking ... done.
> Loading package filepath-1.4.0.0 ... linking ... done.
> Loading package deepseq-1.4.1.1 ... linking ... done.
> Loading package time-1.5.0.1 ... linking ... done.
> Loading package bytestring-0.10.6.0 ... linking ... done.
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
> librt.so
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
> libutil.so
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
> libdl.so
> *** gcc:
> /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
> -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
> libpthread.so
> Loading package unix-2.7.1.0 ... linking ... done.
> Loading package directory-1.2.2.0 ... linking ... done.
> Loading package old-locale-1.0.0.7 ... linking ... done.
> Loading package old-time-1.1.0.3 ... linking ... done.
> Loading package text-1.2.0.4 ... linking ... done.
> Loading package polyparse-1.11 ... linking ... done.
> Loading package cpphs-1.19 ... linking ... done.
> Loading package pretty-1.1.2.0 ... linking ... done.
> Loading package haskell-src-exts-1.16.0.1 ... linking ... done.
> Loading package syb-0.4.4 ... linking ... done.
> Loading package template-haskell-2.10.0.0 ... linking ... done.
> Loading package transformers-0.4.2.0 ... linking ... done.
> Loading package mtl-2.2.1 ... linking ... done.
> Loading package nats-1 ... linking ... done.
> Loading package th-lift-0.7.2 ... linking ... done.
> Loading package containers-0.5.6.2 ... linking ... done.
> Loading package safe-0.3.8 ... linking ... done.
> Loading package th-expand-syns-0.3.0.6 ... linking ... done.
> Loading package th-reify-many-0.1.3 ... linking ... done.
> Loading package th-orphans-0.11.1 ... linking ... done.
> Loading package haskell-src-meta-0.6.0.9 ... linking ... done.
> Loading package haskell-src-exts-qq-0.6.1 ... linking ... done.
>
> Bug.hs:8:16:*** Deleting temp files:
> Deleting: /tmp/ghc7356_0/ghc7356_1.s
> Warning: deleting non-existent /tmp/ghc7356_0/ghc7356_1.s
> *** Deleting temp dirs:
> Deleting: /tmp/ghc7356_0
> ghc: panic! (the 'impossible' happened)
>   (GHC version 7.10.1 for x86_64-unknown-linux):
>         qual_pkg haskell-src-exts-1.16.0.1
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
> }}}
> on my machine:
> {{{
> $ uname -a
> Linux io 3.19.3-1-ARCH #1 SMP PREEMPT Thu Mar 26 14:56:16 CET 2015 x86_64
> GNU/Linux
>
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-
> wrapper
> Target: x86_64-unknown-linux-gnu
> Configured with: /build/gcc/src/gcc-4.9-20150304/configure --prefix=/usr
> --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
> --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
> --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
> --enable-threads=posix --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-
> pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id
> --enable-cloog-backend=isl --enable-lto --enable-plugin --enable-install-
> libiberty --with-linker-hash-style=gnu --disable-multilib --disable-
> werror --enable-checking=release
> Thread model: posix
> gcc version 4.9.2 20150304 (prerelease) (GCC)
>
> $ ghc-pkg list
> /usr/lib/ghc-7.10.1/package.conf.d
>    Cabal-1.22.2.0
>    array-0.5.1.0
>    async-2.0.2
>    base-4.8.0.0
>    bin-package-db-0.0.0.0
>    binary-0.7.3.0
>    bytestring-0.10.6.0
>    containers-0.5.6.2
>    cpphs-1.19
>    deepseq-1.4.1.1
>    directory-1.2.2.0
>    filepath-1.4.0.0
>    ghc-7.10.1
>    ghc-paths-0.1.0.9
>    ghc-prim-0.4.0.0
>    haddock-api-2.16.0
>    haddock-library-1.2.0
>    haskeline-0.7.2.1
>    haskell-src-exts-1.16.0.1
>    haskell-src-exts-qq-0.6.1
>    haskell-src-meta-0.6.0.9
>    hoopl-3.10.0.2
>    hpc-0.6.0.2
>    integer-gmp-1.0.0.0
>    minisat-0.1.1
>    mtl-2.2.1
>    nats-1
>    old-locale-1.0.0.7
>    old-time-1.1.0.3
>    polyparse-1.11
>    pretty-1.1.2.0
>    process-1.2.3.0
>    rts-1.0
>    safe-0.3.8
>    satchmo-core-0.8.0
>    stm-2.4.4
>    syb-0.4.4
>    template-haskell-2.10.0.0
>    terminfo-0.4.0.1
>    text-1.2.0.4
>    th-expand-syns-0.3.0.6
>    th-lift-0.7.2
>    th-orphans-0.11.1
>    th-reify-many-0.1.3
>    time-1.5.0.1
>    transformers-0.4.2.0
>    unix-2.7.1.0
>    xhtml-3000.2.1
> }}}

New description:

 Compiling `Bug.hs`:

 {{{#!hs
 {-# LANGUAGE QuasiQuotes #-}

 import Language.Haskell.Exts.QQ (dec)

 main :: IO ()
 main = return ()
   where
     foo = [dec| bar = 3 |]
 }}}
 by `ghc --make -v -dcore-lint Bug.hs` gives
 {{{
 ghc --make -v -dcore-lint Bug.hs
 Glasgow Haskell Compiler, Version 7.10.1, stage 2 booted by GHC version
 7.8.4
 Using binary package database:
 /usr/lib/ghc-7.10.1/package.conf.d/package.cache
 wired-in package ghc-prim mapped to ghc-
 prim-0.4.0.0-7c945cc0c41d3b7b70f3edd125671166
 wired-in package integer-gmp mapped to integer-
 gmp-1.0.0.0-3c947e5fb6dca14804d9b2793c521b67
 wired-in package base mapped to
 base-4.8.0.0-1b689eb8d72c4d4cc88f445839c1f01a
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.10.0.0-e895139a0ffff267d412e3d0191ce93b
 wired-in package ghc mapped to ghc-7.10.1-325809317787a897b7a97d646ceaa3a3
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 Hsc static flags:
 wired-in package ghc-prim mapped to ghc-
 prim-0.4.0.0-7c945cc0c41d3b7b70f3edd125671166
 wired-in package integer-gmp mapped to integer-
 gmp-1.0.0.0-3c947e5fb6dca14804d9b2793c521b67
 wired-in package base mapped to
 base-4.8.0.0-1b689eb8d72c4d4cc88f445839c1f01a
 wired-in package rts mapped to builtin_rts
 wired-in package template-haskell mapped to template-
 haskell-2.10.0.0-e895139a0ffff267d412e3d0191ce93b
 wired-in package ghc mapped to ghc-7.10.1-325809317787a897b7a97d646ceaa3a3
 wired-in package dph-seq not found.
 wired-in package dph-par not found.
 *** Chasing dependencies:
 Chasing modules from: *Bug.hs
 Stable obj: []
 Stable BCO: []
 Ready for upsweep
   [NONREC
       ModSummary {
          ms_hs_date = 2015-04-09 10:01:43.312180074 UTC
          ms_mod = Main,
          ms_textual_imps = [import (implicit) Prelude,
                             import Language.Haskell.Exts.QQ ( dec )]
          ms_srcimps = []
       }]
 *** Deleting temp files:
 Deleting:
 compile: input file Bug.hs
 Created temporary directory: /tmp/ghc7356_0
 *** Checking old interface for Main:
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )
 *** Parser:
 *** Renamer/typechecker:
 *** Simplify:
 *** CorePrep:
 *** ByteCodeGen:
 Loading package ghc-prim-0.4.0.0 ... linking ... done.
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/usr/lib/ghc-7.10.1/integ_2aU3IZNMF9a7mQ0OzsZ0dS --print-file-name
 libgmp.so
 Loading package integer-gmp-1.0.0.0 ... linking ... done.
 Loading package base-4.8.0.0 ... linking ... done.
 Loading package array-0.5.1.0 ... linking ... done.
 Loading package filepath-1.4.0.0 ... linking ... done.
 Loading package deepseq-1.4.1.1 ... linking ... done.
 Loading package time-1.5.0.1 ... linking ... done.
 Loading package bytestring-0.10.6.0 ... linking ... done.
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
 librt.so
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
 libutil.so
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
 libdl.so
 *** gcc:
 /usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE
 -L/usr/lib/ghc-7.10.1/unix_G4Yo1pNtYrk8nCq1cx8P9d --print-file-name
 libpthread.so
 Loading package unix-2.7.1.0 ... linking ... done.
 Loading package directory-1.2.2.0 ... linking ... done.
 Loading package old-locale-1.0.0.7 ... linking ... done.
 Loading package old-time-1.1.0.3 ... linking ... done.
 Loading package text-1.2.0.4 ... linking ... done.
 Loading package polyparse-1.11 ... linking ... done.
 Loading package cpphs-1.19 ... linking ... done.
 Loading package pretty-1.1.2.0 ... linking ... done.
 Loading package haskell-src-exts-1.16.0.1 ... linking ... done.
 Loading package syb-0.4.4 ... linking ... done.
 Loading package template-haskell-2.10.0.0 ... linking ... done.
 Loading package transformers-0.4.2.0 ... linking ... done.
 Loading package mtl-2.2.1 ... linking ... done.
 Loading package nats-1 ... linking ... done.
 Loading package th-lift-0.7.2 ... linking ... done.
 Loading package containers-0.5.6.2 ... linking ... done.
 Loading package safe-0.3.8 ... linking ... done.
 Loading package th-expand-syns-0.3.0.6 ... linking ... done.
 Loading package th-reify-many-0.1.3 ... linking ... done.
 Loading package th-orphans-0.11.1 ... linking ... done.
 Loading package haskell-src-meta-0.6.0.9 ... linking ... done.
 Loading package haskell-src-exts-qq-0.6.1 ... linking ... done.

 Bug.hs:8:16:*** Deleting temp files:
 Deleting: /tmp/ghc7356_0/ghc7356_1.s
 Warning: deleting non-existent /tmp/ghc7356_0/ghc7356_1.s
 *** Deleting temp dirs:
 Deleting: /tmp/ghc7356_0
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.10.1 for x86_64-unknown-linux):
         qual_pkg haskell-src-exts-1.16.0.1

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}
 on my machine:
 {{{
 $ uname -a
 Linux io 3.19.3-1-ARCH #1 SMP PREEMPT Thu Mar 26 14:56:16 CET 2015 x86_64
 GNU/Linux

 $ gcc -v
 Using built-in specs.
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-
 wrapper
 Target: x86_64-unknown-linux-gnu
 Configured with: /build/gcc/src/gcc-4.9-20150304/configure --prefix=/usr
 --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
 --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
 --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-
 libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
 --disable-libssp --enable-gnu-unique-object --enable-linker-build-id
 --enable-cloog-backend=isl --enable-lto --enable-plugin --enable-install-
 libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror
 --enable-checking=release
 Thread model: posix
 gcc version 4.9.2 20150304 (prerelease) (GCC)

 $ ghc-pkg list
 /usr/lib/ghc-7.10.1/package.conf.d
    Cabal-1.22.2.0
    array-0.5.1.0
    async-2.0.2
    base-4.8.0.0
    bin-package-db-0.0.0.0
    binary-0.7.3.0
    bytestring-0.10.6.0
    containers-0.5.6.2
    cpphs-1.19
    deepseq-1.4.1.1
    directory-1.2.2.0
    filepath-1.4.0.0
    ghc-7.10.1
    ghc-paths-0.1.0.9
    ghc-prim-0.4.0.0
    haddock-api-2.16.0
    haddock-library-1.2.0
    haskeline-0.7.2.1
    haskell-src-exts-1.16.0.1
    haskell-src-exts-qq-0.6.1
    haskell-src-meta-0.6.0.9
    hoopl-3.10.0.2
    hpc-0.6.0.2
    integer-gmp-1.0.0.0
    minisat-0.1.1
    mtl-2.2.1
    nats-1
    old-locale-1.0.0.7
    old-time-1.1.0.3
    polyparse-1.11
    pretty-1.1.2.0
    process-1.2.3.0
    rts-1.0
    safe-0.3.8
    satchmo-core-0.8.0
    stm-2.4.4
    syb-0.4.4
    template-haskell-2.10.0.0
    terminfo-0.4.0.1
    text-1.2.0.4
    th-expand-syns-0.3.0.6
    th-lift-0.7.2
    th-orphans-0.11.1
    th-reify-many-0.1.3
    time-1.5.0.1
    transformers-0.4.2.0
    unix-2.7.1.0
    xhtml-3000.2.1
 }}}

--

Comment:

 Sadly it appears there isn't any good fix here. Instead, we must simply
 document our way around the problem. To quote osa1 on Phab:D1342,

 > I realized while thinking about this today that this new API is not a
 solution to `NameG` problems caused by new `UnitId` business, because
 query functions like `reifyPackage` are running in `Q`, so running TH is
 needed for these functions.
 >
 > But the whole point of using `NameG` instead of generating names using
 quotations was to avoid running TH.
 >
 > So this API doesn't solve the problem.
 >
 > We were chatting with @ezyang on IRC and he showed me two things:
 >
 > 1. Cabal now has a macro `CURRENT_PACKAGE_KEY` which will keep things
 working even when `NameG` is used. (it only helps if we refer to the
 current package of course, but that's enough for most of the use cases)
 >
 > 2. With next major release we'll have this:
 https://git.haskell.org/ghc.git/commitdiff/f16ddcee0c64a92ab911a7841a8cf64e3ac671fd
 which will solve all the problems caused by `NameG` and `UnitIds`.
 >
 > Long story short, this patch is not needed. What we need is to document
 things. And also `template-haskell` package needs some cleaning. For
 example, we can hide `Name` stuff. We can move some types that are used by
 TH generated code to an internal module to prevent users from using them.
 For example, why `mkNameG_v` even in `Language.Haskell.TH.Syntax`? It's
 not documented, it's not supposed to be used by users. The whole package
 is a mess.
 >
 > Oh, also, the package database I'm using in this patch is not the
 database I should be using. Because such a database doesn't even exist. I
 actually asked about this here:
 https://phabricator.haskell.org/D1342#38429 and got this answer:
 https://phabricator.haskell.org/D1342#38441 which was misleading.

 Consequently I'll be closing this as wontfix.

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


More information about the ghc-tickets mailing list