Ticket #3833 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Panic on standlone deriving without GeneralizedNewtypeDeriving

Reported by: Khudyakov Owned by: igloo
Priority: normal Milestone:
Component: Compiler Version: 6.12.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty:
Test Case: T3833 Blocked By:
Blocking: Related Tickets:

Description

I found that GHC panics on the following program if GeneralizedNewtypeDeriving? pragma is removed. Otherwise it works just fine.

{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-} -- Removal causes crash
import Data.Monoid

newtype DecodeMap e = DecodeMap [e]

deriving instance Monoid (DecodeMap e)

Here is error message it produce

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.1 for i386-unknown-linux):
        genDerivBinds: bad derived class base:Data.Monoid.Monoid{tc rha}

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

This bug appears only in GHC6.12.1. GHC6.10.4 rightfully complain that I should enable GeneralizedNewtypeDeriving? unstead of crashing.

Attachments

3833-patch Download (57.8 KB) - added by simonpj 3 years ago.
Patch for Trac 3833

Change History

Changed 3 years ago by simonpj

Patch for Trac 3833

Changed 3 years ago by simonpj

  • owner set to igloo

It turns out that the patch

Mon Dec  7 13:08:50 GMT 2009  simonpj@microsoft.com
  * Tidy up deriving error messages

on the HEAD fixes the problem.

Attached is a 6.12-specific version of the patch. I have not applied it because it causes a dozen test to have slightly different error message output.

Ian, could you

  • Apply the patch to the branch
  • Accept the error message wibbles (if in doubt ask me)
  • Add a test to the HEAD regression suite
  • Close this and #3834

Thanks

Simon

Changed 3 years ago by igloo

  • status changed from new to closed
  • testcase set to T3833
  • resolution set to fixed

All done

Note: See TracTickets for help on using tickets.