[GHC] #8603: GHC crashes on some code using StateT monad transformer
#8603: GHC crashes on some code using StateT monad transformer -------------------------------------+------------------------------------- Reporter: person1729 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.6.3 checker) | Operating System: MacOS X Keywords: | Type of failure: Compile-time Architecture: x86_64 (amd64) | crash Difficulty: Unknown | Test Case: Attached Blocked By: | Blocking: Related Tickets: | -------------------------------------+------------------------------------- GHC version 7.6.3 on Mac OS X 10.9 crashes with the following message when compiling the attached file: {{{ ghc -c -v3 -dcore-lint DiscreteRandomVariableST.hs }}} {{{ Glasgow Haskell Compiler, Version 7.6.3, stage 2 booted by GHC version 7.4.2 Using binary package database: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/package.conf.d/package.cache Using binary package database: /Users/***/.ghc/x86_64-darwin-7.6.3/package.conf.d/package.cache hiding package binary-0.5.1.1 to avoid conflict with later version binary-0.7.1.0 hiding package Cabal-1.16.0 to avoid conflict with later version Cabal-1.18.1.2 wired-in package ghc-prim mapped to ghc- prim-0.3.0.0-d5221a8c8a269b66ab9a07bdc23317dd wired-in package integer-gmp mapped to integer- gmp-0.5.0.0-2f15426f5b53fe4c6490832f9b20d8d7 wired-in package base mapped to base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 wired-in package rts mapped to builtin_rts wired-in package template-haskell mapped to template- haskell-2.8.0.0-c2c1b21dbbb37ace4b7dc26c966ec664 wired-in package dph-seq not found. wired-in package dph-par not found. Hsc static flags: -static Created temporary directory: /var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0 *** C pre-processor: '/sw/bin/gcc-4' '-E' '-undef' '-traditional' '-m64' '-fno-stack-protector' '-m64' '-I' '/Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/base-4.6.0.1/include' '-I' '/Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/include' '-D__GLASGOW_HASKELL__=706' '-Ddarwin_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Ddarwin_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-U __PIC__' '-D__PIC__' '-x' 'c' 'DiscreteRandomVariableST.hs' '-o' '/var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0/ghc13041_0.hscpp' *** Checking old interface for main:DiscreteRandomVariableST: *** Parser: *** Renamer/typechecker: DiscreteRandomVariableST.hs:186:17: Couldn't match kind `* -> *' with `*' Expected type: [t1] -> StateT s RV t0 Actual type: [t1] -> StateT s RV t0 Kind incompatibility when matching types: [t_t14] :: * -> * [t1] :: * The function `lift'*** Deleting temp files: Deleting: /var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0/ghc13041_0.s /var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0/ghc13041_0.hscpp Warning: deleting non-existent /var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0/ghc13041_0.s *** Deleting temp dirs: Deleting: /var/folders/dg/lby0mtps13l9g0lry_dhsv1c0000gn/T/ghc13041_0 ghc: panic! (the 'impossible' happened) (GHC version 7.6.3 for x86_64-apple-darwin): kindFunResult ghc-prim:GHC.Prim.*{(w) tc 34d} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug}}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer --------------------------------------------+------------------------------ Reporter: person1729 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: Attached | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"8721743e88f4c8c385eb0ceb0ca6804b2143a8fa/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="8721743e88f4c8c385eb0ceb0ca6804b2143a8fa" Re-factor TcCanonical (again), fixes Trac #8603 This is a substantial refactoring of the canonicaliser. The proximate cause was that we were sometimes failing to correctly orient a tyvar/tyvar equality (x ~ y), because the kind of x or y was not fully zonked at the moment we compared them. That in turn led me to look closely at the way that canEvNC (which decomposes equalities) worked. * The big change is that the 'reOrient' and 'classify' functions are gone, along with classify's 'TypeClassifier' return type. Instead the re-orientation is built into canEqNC. When we find a type variable we divert into canEqTyVar, and so on, very much as in TcUnify. * TcCanonical.canEqTyVar, canEqLeafFun, etc now carry a SwapFlag (to reduce duplication), just as in TcUnify; now SwapFlag itself is defined in BasicTypes * I renamed TcSMonad.rewriteCtFlavor to rewriteEvidence, * I added a new specialised version of rewriteEvidence, called TcSMonad.rewriteEqEvidence. It is easier to use, and removes the crafty but brain-mangling higher order casts that we were using before. The result is not exactly simpler, but it's pretty clear and, I think, significantly more efficient. And it fixes Trac #8603! }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer --------------------------------------------+------------------------------ Reporter: person1729 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: Attached | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: --------------------------------------------+------------------------------ Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"b34bee3a45204ff43fa31e9dee3a23a74aa252db/testsuite"]: {{{ #!CommitTicketReference repository="testsuite" revision="b34bee3a45204ff43fa31e9dee3a23a74aa252db" Test Trac #8603 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer ------------------------------------------------+-------------------------- Reporter: person1729 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: typecheck/should_fail/T8603 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * status: new => closed * testcase: Attached => typecheck/should_fail/T8603 * resolution: => fixed Comment: Thanks for identifying this bug! Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer ------------------------------------------------+-------------------------- Reporter: person1729 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: typecheck/should_fail/T8603 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by monoidal): I don't understand completely what's going on here, but in your program `lift uniform [1,2,3]` should be `lift (uniform [1,2,3])`. This makes it compile under GHC 7.6. (I thought this error had long already been fixed in 7.7. Strange.) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer ------------------------------------------------+-------------------------- Reporter: person1729 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: typecheck/should_fail/T8603 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by simonpj): The point is that a type-incorrect program made GHC crash. That shouldn't happen, and that's what I fixed. Making the program itself right is another matter, as you point out. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer ------------------------------------------------+-------------------------- Reporter: person1729 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: typecheck/should_fail/T8603 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by monoidal): What confuses me is that before the commit 7.7 already did not crash for this program. I checked that a6f6169a9939525c859b274955e8606d6080100f (commit just before yours) and HEAD give the same error message. Was the commit just internal refactoring, or has it visible consequences? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8603: GHC crashes on some code using StateT monad transformer ------------------------------------------------+-------------------------- Reporter: person1729 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type checker) | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Compile-time crash | (amd64) Test Case: typecheck/should_fail/T8603 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by simonpj): Well that is puzzling. I was sure I saw HEAD crash with `kindFunResult` panic. Anyway, regardless the refactoring is a good thing, I think. There really was a bug before. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8603#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC