Ticket #7023 (closed bug: fixed)

Opened 11 months ago

Last modified 10 months ago

Panic when compiling with -fdefer-type-errors

Reported by: guest Owned by: simonpj
Priority: normal Milestone:
Component: Compiler Version: 7.5
Keywords: Cc:
Operating System: MacOS X Architecture: Unknown/Multiple
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: typecheck/should_run/T7023 Blocked By:
Blocking: Related Tickets:

Description

Running 7.5.20120621

Compiling attached program causes panic.

Attachments

hello.hs Download (84 bytes) - added by guest 11 months ago.
ghc -fdefer-type-errors hello.hs

Change History

Changed 11 months ago by guest

ghc -fdefer-type-errors hello.hs

Changed 11 months ago by guest

Sorry about the guest posting, signup seems to be down (just time'd out) I'll CC myself when I can get an account.

Changed 11 months ago by dreixel

  • architecture changed from x86_64 (amd64) to Unknown/Multiple

I can confirm this. Compilation fails with:

ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 7.5 for i386-unknown-linux):
        cgLookupPanic (probably invalid Core; try -dcore-lint)
    cobox{v ahw} [lid]
    static binds for:
    local binds for:

-dcore-lint gives us:

[1 of 1] Compiling Main             ( Bug.hs, Bug.o )
*** Core Lint errors : in result of Desugar (after optimization) ***
<no location info>: Warning:
    In the expression: GHC.Types.:
                         @ [GHC.Types.Char]
                         (case cobox_ahw of _ { GHC.Types.Eq# cobox_dir ->
                          (GHC.Types.I# 1)
                          `cast` (cobox_dir :: GHC.Types.Int ~# [GHC.Types.Char])
                          })
                         (GHC.Types.[] @ [GHC.Types.Char])
    cobox_ahw :: GHC.Types.Int ~ [GHC.Types.Char]
    [LclId] is out of scope
*** Offending Program ***
Rec {
Main.a :: [[GHC.Types.Char]]
[LclIdX]
Main.a =
  GHC.Types.:
    @ [GHC.Types.Char]
    (GHC.Types.:
       @ GHC.Types.Char
       (GHC.Types.C# 'x')
       (GHC.Types.[] @ GHC.Types.Char))
    (GHC.Types.:
       @ [GHC.Types.Char]
       (case cobox_ahw of _ { GHC.Types.Eq# cobox_dir ->
        (GHC.Types.I# 1)
        `cast` (cobox_dir :: GHC.Types.Int ~# [GHC.Types.Char])
        })
       (GHC.Types.[] @ [GHC.Types.Char]))

Main.main :: GHC.Types.IO ()
[LclIdX]
Main.main =
  System.IO.putStrLn (GHC.CString.unpackCString# "Hello World")

:Main.main :: GHC.Types.IO ()
[LclIdX]
:Main.main = GHC.TopHandler.runMainIO @ () Main.main
end Rec }

*** End of Offense ***


<no location info>: 
Compilation had errors

I'm not entirely sure what's going on, though. Why did cobox_ahw not get replaced by its evidence (a runtime error)?

Changed 11 months ago by simonpj

  • owner set to simonpj
  • difficulty set to Unknown

I'll investigate.

Changed 10 months ago by simonpj@…

commit c1f01e351759e7c25818b05e32bdb7b702dac6f2

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Sat Jul 14 13:18:34 2012 +0100

    Do not discard insoluble constraints in simplifyInfer
    
    Before -fdefer-type-errors there we no insolubles
    (because we'd have failed before then), but with -fdefer-type-errors
    there can be.  The code is acutally a bit simpler: we just call
    emitConstraints, and eliminate the bogus-looking emitWC from TcRnMonad.
    
    There's a bit more tidying up to do, concerning the places we use
    keepWanted, but I need to talk to Dimitrios about that.
    
    Meanwhile this fixes Trac #7023

 compiler/typecheck/TcRnMonad.lhs  |    5 -----
 compiler/typecheck/TcSimplify.lhs |    7 ++++---
 2 files changed, 4 insertions(+), 8 deletions(-)

Changed 10 months ago by simonpj

  • status changed from new to closed
  • testcase set to typecheck/should_run/T7023
  • resolution set to fixed

Thanks! The above patch fixes it.

Simon

Note: See TracTickets for help on using tickets.