[GHC] #9975: RecordWildcards and PatternSynonyms cause impossible bug

GHC ghc-devs at haskell.org
Wed Jan 21 12:18:13 UTC 2015


#9975: RecordWildcards and PatternSynonyms cause impossible bug
-------------------------------------+-------------------------------------
        Reporter:  gamegoblin        |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.10.1
       Component:  Compiler          |                 Version:  7.10.1-rc1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |  RecordWildcards PatternSynonyms
 Type of failure:  Compile-time      |            Architecture:  x86_64
  crash                              |  (amd64)
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by hvr):

 * cc: cactus (added)
 * os:  MacOS X => Unknown/Multiple
 * milestone:   => 7.10.1


Old description:

> When using RecordWildcards with PatternSynonyms, I have found a way to
> cause this bug:
>
> $ /usr/local/bin/ghc-7.10.0.20141222 test.hs
> [1 of 1] Compiling Main             ( test.hs, test.o )
> ghc: panic! (the 'impossible' happened)
>   (GHC version 7.10.0.20141222 for x86_64-apple-darwin):
>         find_tycon
>   Test
>   [Test defined at test.hs:6:9,
>    Test parent:Test defined at test.hs:4:13]
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
>

> Here is the full code that causes it:
>
> {{{#!hs
> {-# LANGUAGE RecordWildCards #-}
> {-# LANGUAGE PatternSynonyms #-}
> data Test = Test { x :: Int }
> pattern Test wat = Test { x = wat }
> }}}
>
> If you remove RecordWildCards, the bug does not happen.

New description:

 When using RecordWildcards with PatternSynonyms, I have found a way to
 cause this bug:

 {{{
 $ /usr/local/bin/ghc-7.10.0.20141222 test.hs
 [1 of 1] Compiling Main             ( test.hs, test.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.10.0.20141222 for x86_64-apple-darwin):
         find_tycon
   Test
   [Test defined at test.hs:6:9,
    Test parent:Test defined at test.hs:4:13]

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

 Here is the full code that causes it:

 {{{#!hs
 {-# LANGUAGE RecordWildCards #-}
 {-# LANGUAGE PatternSynonyms #-}
 data Test = Test { x :: Int }
 pattern Test wat = Test { x = wat }
 }}}

 If you remove `RecordWildCards`, the bug does not happen.

--

Comment:

 Maybe this was fixed already, as I can't reproduce it anymore with a
 current `ghc-7.10` snapshot:

 {{{
 $ ghc-7.10.0.20150119 -c test.hs

 test.hs:4:1:
     Multiple declarations of ‘Test’
     Declared at: test.hs:3:13
                  test.hs:4:1

 }}}

 It may be worth bisecting to find out which commit fixed it, unless cactus
 happens to know already which commit fixed it...

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


More information about the ghc-tickets mailing list