Opened 5 years ago

Closed 5 years ago

#6060 closed bug (fixed)

the 'impossible' happened

Reported by: lerkok Owned by:
Priority: normal Milestone: 7.6.1
Component: Compiler Version: 7.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case: rename/should_fail/T6060
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


$ cat bug.hs 
foo = do let bad = [True | x <- [] | y <- []]
$ ghc bug.hs 
[1 of 1] Compiling Main             ( bug.hs, bug.o )

bug.hs:1:10:ghc: panic! (the 'impossible' happened)
  (GHC version 7.4.1 for x86_64-apple-darwin):

Attachments (2)

6060.patch (1.2 KB) - added by pcapriotti 5 years ago.
6060-test.patch (1.5 KB) - added by pcapriotti 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by pcapriotti

difficulty: Unknown
Milestone: 7.6.1
Type of failure: None/UnknownCompile-time crash

Thanks for the report.

Changed 5 years ago by pcapriotti

Attachment: 6060.patch added

Changed 5 years ago by pcapriotti

Attachment: 6060-test.patch added

comment:2 Changed 5 years ago by pcapriotti

Status: newpatch

The pretty printer for parallel comprehensions is broken. Attached patch and testcase.

comment:3 Changed 5 years ago by simonpj@…

commit 67c793a3a13482bc897810e3b5e13f96942afc68

Author: Simon Peyton Jones <>
Date:   Tue May 1 08:07:52 2012 +0100

    Tidy up a remaining glitch in unification
    There was one place, in type checking parallel list comprehensions
    where we were unifying types, but had no convenient way to use the
    resulting coercion; instead we just checked that it was Refl.  This
    was Wrong Wrong; it might fail unpredicably in a GADT-like situation,
    and it led to extra error-generation code used only in this one place.
    This patch tidies it all up, by moving the 'return' method from the
    *comprehension* to the ParStmtBlock. The latter is a new data type,
    now used for each sub-chunk of a parallel list comprehension.
    Because of the data type change, quite a few modules are touched,
    but only in a fairly trivial way. The real changes are in TcMatches
    (and corresponding desugaring); plus deleting code from TcUnify.
    This patch also fixes the pretty-printing bug in Trac #6060

 compiler/deSugar/Coverage.lhs    |   14 ++++----
 compiler/deSugar/DsArrows.lhs    |    4 +-
 compiler/deSugar/DsListComp.lhs  |   39 ++++++++++-----------
 compiler/hsSyn/Convert.lhs       |    4 +-
 compiler/hsSyn/HsExpr.lhs        |   33 ++++++++++++------
 compiler/hsSyn/HsUtils.lhs       |   12 +++---
 compiler/main/HscMain.hs         |    4 +-
 compiler/parser/Parser.y.pp      |    3 +-
 compiler/rename/RnExpr.lhs       |   29 +++++++--------
 compiler/typecheck/TcErrors.lhs  |    8 ----
 compiler/typecheck/TcHsSyn.lhs   |   23 ++++++------
 compiler/typecheck/TcMatches.lhs |   70 ++++++++++----------------------------
 compiler/typecheck/TcUnify.lhs   |   11 ------
 13 files changed, 104 insertions(+), 150 deletions(-)

comment:4 Changed 5 years ago by simonpj

Resolution: fixed
Status: patchclosed
Test Case: rename/should_fail/T6060

Thanks. Coincidentally I found an old patch I've been meaning to commit for ages, that overlapped, so I combined them.


Note: See TracTickets for help on using tickets.