Opened 14 months ago

Last modified 4 weeks ago

#7687 new bug

ghc panic on TH and deriveJSON

Reported by: guest Owned by:
Priority: normal Milestone: 7.8.3
Component: Template Haskell Version: 7.4.2
Keywords: TH Cc:
Operating System: Windows Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: Blocked By: #3658
Blocking: Related Tickets:

Description (last modified by igloo)

{-# LANGUAGE CPP,TemplateHaskell #-}
module Main (main) where

import Data.Aeson.TH
data Test     = Test Int deriving Show
deriveJSON id ''Test
main = return ()

will give

Building aeson-test-0.0.1...
Preprocessing test suite 'test-aeson-test' for aeson-test-0.0.1...
[1 of 1] Compiling Main             ( src\Main.hs, dist\build\test-aeson-test\test-aeson-test-tmp\Main.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
ghc.exe: panic! (the 'impossible' happened)
Loading package text-0.11.2.3 ... linking ... done.
  (GHC version 7.4.2 for i386-unknown-mingw32):
Loading package attoparsec-0.10.4.0 ... linking ... done.
	loadObj "C:\\Users\\User\\AppData\\Roaming\\cabal\\hashable-1.2.0.5\\ghc-7.4.2\\HShashable-1.2.0.5.o": failed
Loading package blaze-builder-0.3.1.0 ... linking ... done.

Loading package dlist-0.5 ... linking ... done.
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Loading package hashable-1.2.0.5 ... 

ghc.exe: Unknown PEi386 section name `.text.startup' (while processing: C:\Users\User\AppData\Roaming\cabal\hashable-1.2.0.5\ghc-7.4.2\HShashable-1.2.0.5.o)

Change History (5)

comment:1 in reply to: ↑ description Changed 14 months ago by guest

Excuse me, wrong copypaste info
This is the 'right' result

Building aeson-test-0.0.1...
Preprocessing test suite 'test-aeson-test' for aeson-test-0.0.1...
[1 of 1] Compiling Main             ( src\Main.hs, dist\build\test-aeson-test\test-aeson-test-tmp\Main.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package attoparsec-0.10.4.0 ... linking ... done.
Loading package blaze-builder-0.3.1.0 ... linking ... done.
Loading package dlist-0.5 ... linking ... done.
Loading package hashable-1.2.0.5 ... 
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 7.4.2 for i386-unknown-mingw32):
	loadObj "C:\\Users\\User\\AppData\\Roaming\\cabal\\hashable-1.2.0.5\\ghc-7.4.2\\HShashable-1.2.0.5.o": failed

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

ghc.exe: Unknown PEi386 section name `.text.startup' (while processing: C:\Users\User\AppData\Roaming\cabal\hashable-1.2.0.5\ghc-7.4.2\HShashable-1.2.0.5.o)

comment:2 Changed 13 months ago by igloo

  • Description modified (diff)
  • Difficulty set to Unknown

comment:3 Changed 13 months ago by igloo

  • Description modified (diff)

comment:4 Changed 13 months ago by igloo

  • Blocked By 3658 added
  • Milestone set to 7.8.1

Thanks for the report. This will be fixed by using the system linker in ghci.

comment:5 Changed 4 weeks ago by George

When I try to compile the code above in Description I get

Couldn't match expected type ‘Options’ with actual type ‘a0 -> a0’
Probable cause: ‘id’ is applied to too few arguments
In the first argument of ‘deriveJSON’, namely ‘id’
In the expression: deriveJSON id Test

Note: See TracTickets for help on using tickets.