Ticket #2310 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

Panic in ghci 6.8.2 with -fglasgow-exts

Reported by: guest Owned by: igloo
Priority: normal Milestone: 6.10.1
Component: GHCi Version: 6.8.2
Keywords: Cc:
Operating System: Linux Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: T2310 Blocked By:
Blocking: Related Tickets:

Description

Steps to reproduce:

1. Run "ghci -fglasgow-exts"

2. Enter: "let const :: (forall a. (forall b. a->b)) = \x::a -> (\y -> x) :: (forall b. b -> a)".

Result:

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> let const :: (forall a. (forall b. a->b)) = \x::a -> (\y -> x) :: (forall b. b -> a)
ghc-6.8.2: panic! (the 'impossible' happened)
 (GHC version 6.8.2 for i386-unknown-linux):
	nameModule a{tv anJ}

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

Let me know if any more information would be helpful. This is all on a Ubuntu 8.04. I have included below the output of running the above with "ghci -v -fglasgow-exts":

ghci -v

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 6.8.2, for Haskell 98, stage 2 booted by GHC version 6.8.2
Using package config file: /usr/lib/ghc-6.8.2/package.conf
wired-in package base mapped to base-3.0.1.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0.1.0
wired-in package template-haskell mapped to template-haskell-2.2.0.0
wired-in package ndp not found.
Hsc static flags: -static
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package base ... linking ... done.
*** Parser:
*** Desugar:
*** Simplify: 
*** CorePrep:
*** ByteCodeGen:
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Prelude> let const :: (forall a. (forall b. a->b)) = \x::a -> (\y -> x) :: (forall b. b -> a)
*** Parser:
ghc-6.8.2: panic! (the 'impossible' happened)
 (GHC version 6.8.2 for i386-unknown-linux):
	nameModule a{tv anJ}

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

Change History

Changed 5 years ago by guest

A little bit more info (following the wiki guidelines, although I don't know if any of this is useful):

uname -a

Linux 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux

gcc -v

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang \
  --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib \
  --without-included-gettext --enable-threads=posix --enable-nls \
  --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu \
  --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all \
  --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)

Adding the "-dcore-line" flags has no effect.

The problem does not appear without the "-fglasgow-exts" flag:

Prelude> let const :: (forall a. (forall b. a->b)) = \x::a -> (\y -> x) :: (forall b. b -> a)

<interactive>:1:4:
    Illegal signature in pattern: forall a . (forall b . (a -> b))
        Use -XPatternSignatures to permit it

<interactive>:1:48:
    Illegal signature in pattern: a
        Use -XPatternSignatures to permit it

<interactive>:1:75:
    Illegal operator `.' in type `forall b . (b -> a)'
      (Use -XTypeOperators to allow operators in types)

'Hope this helps.

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10 branch

Thanks for the report. Also happens in the HEAD. Here's a smaller example:

$ ghci -XScopedTypeVariables -XPatternSignatures -v0
Prelude> let c = \ x :: a -> (x :: a)
ghc-6.9.20080523: panic! (the 'impossible' happened)
  (GHC version 6.9.20080523 for x86_64-unknown-linux):
        nameModule a{tv am3}

Changed 5 years ago by simonpj

  • owner set to igloo
  • testcase set to T2310
  • type changed from bug to merge

Ah. You probably meant

  c = \(x::a) -> (x::a)

The example you actually give (now in tests rename/should_fail/T2310.hs) is the old syntax for "result signatures", which isn't supported any more.

Better error report in

Wed Jun  4 15:51:15 BST 2008  simonpj@microsoft.com
  * Fix Trac #2310: result type signatures are not supported any more

namely

T2310.hs:5:21:
    Illegal result type signature `a'
      Result signatures are no longer supported in pattern matches
    In a lambda abstraction: \ x :: a -> (x :: a)

Maybe worth merging, since it fixes a crash.

Simon

Changed 5 years ago by igloo

  • status changed from new to closed
  • type changed from merge to bug
  • resolution set to fixed
  • milestone changed from 6.10 branch to 6.10.1

Wasn't merged in time for 6.8.3

Note: See TracTickets for help on using tickets.