Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1356 closed bug (worksforme)

"derive instance" panics ghc-6.7.20070404

Reported by: kramer@… Owned by: igloo
Priority: normal Milestone:
Component: Compiler Version: 6.7
Keywords: deriving instance Cc:
Operating System: MacOS X Architecture: powerpc
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj)

I've been happy to see the support for "dervice instance". In the past I've had to make a copy of parsec, just to dervice Data and Typeable for the Pos type in order to do SYB on my AST.

Unfortunately "dervive instance" panics the 6.7 compiler at the moment (I need/want 6.7 since the -fhpc support rocks!).

> import Text.ParserCombinators.Parsec.Pos as PPos
> ...
> derive instance Data PPos.SourcePos

This produces:

TLACodeGen.hs:485:0:ghc-6.7.20070404: panic! (the 'impossible' happened)
  (GHC version 6.7.20070404 for powerpc-apple-darwin):
        newTyConRhs
    main:Text.ParserCombinators.Parsec.Pos.SourcePos{tc r1R}

Details of my system:

yoghurt:~/sdev/specifica/australis reto$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.7.20070404

yoghurt:~/sdev/specifica/australis reto$ uname -a
Darwin yoghurt.local 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep  8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc

yoghurt:~/sdev/specifica/australis reto$ gcc -v 
Reading specs from /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/specs
Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^+.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)

Change History (6)

comment:1 Changed 7 years ago by simonpj

  • Description modified (diff)
  • Owner set to simonpj

comment:2 Changed 7 years ago by simonpj

  • Owner changed from simonpj to igloo

Happily, this one now seems to work. Maybe it got fixed as a result of fixing something else...

Can you confirm that it works for you?

Ian: do you think it's worth a test case?

Simon

comment:3 Changed 7 years ago by guest

  • Resolution set to worksforme
  • Status changed from new to closed

Yes, this works for me for the simple example (ghc 6.7.20070517) on the simple example below. I'll keep working to find a reproducer that gets at the root cause of the panic. Everything's working if I add the Data and Typeable class in my copy of parsec's SourcePos?, but we panic if I use "derive instance" - some weird feature interaction with some other thing I use (but do not use in the simple example?).

Thanks,

  • Reto

module Main where

import Data.Generics
import Text.ParserCombinators?.Parsec.Pos as PPos

derive instance Data PPos.SourcePos?
derive instance Typeable PPos.SourcePos?

data AST = AST [AST]

| SomeNode? PPos.SourcePos? String
| OtherNode? PPos.SourcePos? Int

deriving (Eq, Ord, Show, Data, Typeable)

f = everywhere $ mkT touch

where touch (SomeNode? p s) = SomeNode? p $ s ++ "-touched"

touch (OtherNode? p i) = OtherNode? p $ i + 1

main = do putStrLn $ show (f [SomeNode? p "foo",

OtherNode? p 41])

where p = newPos "file" 0 0

{- [SomeNode? "file" (line 0, column 0) "foo-touched",

OtherNode? "file" (line 0, column 0) 42] -}

comment:4 Changed 7 years ago by guest

Ups, here's the properly formated source that works:

module Main where

import Data.Generics
import Text.ParserCombinators.Parsec.Pos as PPos

derive instance Data     PPos.SourcePos
derive instance Typeable PPos.SourcePos

data AST = AST [AST]
	 | SomeNode PPos.SourcePos String
	 | OtherNode PPos.SourcePos Int
	   deriving (Eq, Ord, Show, Data, Typeable)

f = everywhere $ mkT touch
  where touch (SomeNode p s) = SomeNode p $ s ++ "-touched"
	touch (OtherNode p i) = OtherNode p $ i + 1

main = do putStrLn $ show (f [SomeNode p "foo",
			      OtherNode p 41])
  where p = newPos "file" 0 0

{- [SomeNode "file" (line 0, column 0) "foo-touched",
    OtherNode "file" (line 0, column 0) 42] -}

comment:5 Changed 7 years ago by simonpj

The situation on this bug is that we don't have a test case where it fails. Indeed we have no positive reason to suppose that there is still a problem at all. So unless one emerges, we'll just have to close the bug. It might simply have been fixed meanwhile.

OK, Reto?

Simon

comment:6 Changed 7 years ago by guest

Simon, yes - closing the bug is the right thing to do. Thanks for double checking!

  • Reto
Note: See TracTickets for help on using tickets.