Opened 5 years ago
Closed 3 years ago
#3011 closed bug (fixed)
ASSERT failed: file typecheck/TcMType.lhs line 526 t_a32G{tv}
Reported by: | batterseapower | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 7.2.1 |
Component: | Compiler (Type checker) | Version: | 6.11 |
Keywords: | Cc: | michal.terepeta@… | |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | None/Unknown | Difficulty: | Unknown |
Test Case: | Blocked By: | ||
Blocking: | Related Tickets: |
Description
NB: this is NOT AFAIK a duplicate of the previous ticket about the TcMType ASSERT failure. It was observed on a recent HEAD (as of 6th February 2009) while I happened to be using a stage 2 compiler with -DDEBUG on to compile some code I was working on.
Error is as follows:
$ ./Setup clean && ./Setup configure --with-compiler=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc --with-hc-pkg=/Users/mbolingbroke/Programming/Checkouts/ghc.working/ghc/stage2-inplace/ghc-pkg --ghc --global && ./Setup build && dist/build/vector-tests/vector-tests cleaning... Configuring vector-tests-0.2... Preprocessing executables for vector-tests-0.2... Building vector-tests-0.2... [1 of 3] Compiling Utilities ( Utilities.hs, dist/build/vector-tests/vector-tests-tmp/Utilities.o ) WARNING: file simplCore/SimplCore.lhs line 545 Simplifier still going after 4 iterations; bailing out. Size = 1398 [2 of 3] Compiling Properties ( Properties.hs, dist/build/vector-tests/vector-tests-tmp/Properties.o ) WARNING: file typecheck/TcTyFuns.lhs line 284 (This warning is harmless; for Simon & Manuel) [Wanted t_a32G{tv} [tau] :: ghc-prim:GHC.Types.[]{(w) tc 317} ~ v{tv a2S9} [sk]] ghc: panic! (the 'impossible' happened) (GHC version 6.11.20090204 for i386-apple-darwin): ASSERT failed! file typecheck/TcMType.lhs line 526 t_a32G{tv} [tau] Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Where that code look something like this:
do { ASSERTM2( do { details <- readMetaTyVar tyvar; return (isFlexi details) }, ppr tyvar ) ; traceTc (text "writeMetaTyVar" <+> ppr tyvar <+> text ":=" <+> ppr ty) ; writeMutVar (metaTvRef tyvar) (Indirect ty) }
Full program is attached.
Actually, the program has a type error (as rerunning with a non -DDEBUG build showed):
Properties.hs:78:25: Could not deduce (Data.Vector.Unboxed.IVector [] a) from the context (Eq a, Ord a, Eq (v a), Ord (v a), Show a, Arbitrary a, Model a a, Show (v a), Arbitrary (v a), Model (v a) [a], Data.Vector.Unboxed.IVector v a, Show (v Bool), Arbitrary (v Bool), Model (v Bool) [Bool], Data.Vector.Unboxed.IVector v Bool) arising from a use of `Data.Vector.Unboxed.length' at Properties.hs:78:25-32 Possible fix: add (Data.Vector.Unboxed.IVector [] a) to the context of the type signature for `testVersusLists' or add an instance declaration for (Data.Vector.Unboxed.IVector [] a) In the first argument of `eq1', namely `(Data.Vector.Unboxed.length :: v a -> Int)' In the expression: (Data.Vector.Unboxed.length :: v a -> Int) `eq1` length In the definition of `prop_length': prop_length = (Data.Vector.Unboxed.length :: v a -> Int) `eq1` length Properties.hs:83:25: No instance for (Data.Vector.Unboxed.IVector [] Bool) arising from a use of `Data.Vector.Unboxed.and' at Properties.hs:83:25-29 Possible fix: add an instance declaration for (Data.Vector.Unboxed.IVector [] Bool) In the first argument of `eq1', namely `(Data.Vector.Unboxed.and :: v Bool -> Bool)' In the expression: (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and In the definition of `prop_and': prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and Properties.hs:95:24: Could not deduce (Eq ([a] -> [a])) from the context (Eq a, Ord a, Eq (v a), Ord (v a), Show a, Arbitrary a, Model a a, Show (v a), Arbitrary (v a), Model (v a) [a], Data.Vector.Unboxed.IVector v a, Show (v Bool), Arbitrary (v Bool), Model (v Bool) [Bool], Data.Vector.Unboxed.IVector v Bool) arising from a use of `eq2' at Properties.hs:95:24-86 Possible fix: add (Eq ([a] -> [a])) to the context of the type signature for `testVersusLists' or add an instance declaration for (Eq ([a] -> [a])) In the expression: (Data.Vector.Unboxed.zipWith :: (a -> a -> a) -> v a -> v a -> v a) `eq2` zipWith In the definition of `prop_zipWith': prop_zipWith = (Data.Vector.Unboxed.zipWith :: (a -> a -> a) -> v a -> v a -> v a) `eq2` zipWith In the definition of `testVersusLists': testVersusLists _ = [testGroup "Prelude" prelude_tests, testGroup "Data.List" data_list_tests, testGroup "Extras" extra_tests] where prelude_tests = [testProperty "length" prop_length, ....] prop_length = (Data.Vector.Unboxed.length :: v a -> Int) `eq1` length prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and .... Properties.hs:114:25: Couldn't match expected type `v' against inferred type `[]' `v' is a rigid type variable bound by the type signature for `testVersusLists' at Properties.hs:19:28 In the first argument of `eq2', namely `(enumFromTo :: a -> a -> v a)' In the expression: (enumFromTo :: a -> a -> v a) `eq2` enumFromTo In the definition of `prop_enumFromTo': prop_enumFromTo = (enumFromTo :: a -> a -> v a) `eq2` enumFromTo Properties.hs:115:76: Could not deduce (Enum a) from the context (Eq a, Ord a, Eq (v a), Ord (v a), Show a, Arbitrary a, Model a a, Show (v a), Arbitrary (v a), Model (v a) [a], Data.Vector.Unboxed.IVector v a, Show (v Bool), Arbitrary (v Bool), Model (v Bool) [Bool], Data.Vector.Unboxed.IVector v Bool) arising from a use of `enumFromThenTo' at Properties.hs:115:76-89 Possible fix: add (Enum a) to the context of the type signature for `testVersusLists' In the second argument of `eq3', namely `enumFromThenTo' In the expression: (enumFromThenTo :: a -> a -> a -> v a) `eq3` enumFromThenTo In the definition of `prop_enumFromThenTo': prop_enumFromThenTo = (enumFromThenTo :: a -> a -> a -> v a) `eq3` enumFromThenTo Properties.hs:176:16: Could not deduce (Model [a] [a]) from the context (Eq a, Ord a, Eq (v a), Ord (v a), Show a, Arbitrary a, Model a a, Show (v a), Arbitrary (v a), Model (v a) [a], Data.Vector.Unboxed.IVector v a, Show (v Bool), Arbitrary (v Bool), Model (v Bool) [Bool], Data.Vector.Unboxed.IVector v Bool) arising from a use of `eq2' at Properties.hs:176:16-71 Possible fix: add (Model [a] [a]) to the context of the type signature for `testVersusLists' or add an instance declaration for (Model [a] [a]) In the expression: (Data.Vector.Unboxed.snoc :: v a -> a -> v a) `eq2` snoc In the definition of `prop_snoc': prop_snoc = (Data.Vector.Unboxed.snoc :: v a -> a -> v a) `eq2` snoc In the definition of `testVersusLists': testVersusLists _ = [testGroup "Prelude" prelude_tests, testGroup "Data.List" data_list_tests, testGroup "Extras" extra_tests] where prelude_tests = [testProperty "length" prop_length, ....] prop_length = (Data.Vector.Unboxed.length :: v a -> Int) `eq1` length prop_null = (Data.Vector.Unboxed.null :: v a -> Bool) `eq1` null prop_and = (Data.Vector.Unboxed.and :: v Bool -> Bool) `eq1` and ....
But we probably still shouldn't get the ASSERT.
Attachments (2)
Change History (11)
Changed 5 years ago by batterseapower
comment:1 Changed 5 years ago by simonpj
- Difficulty set to Unknown
I'm 99% sure that it's simply the same bug as #2999. By turning that ASSERT into a WARN, I simply made another ASSERT trigger! So I'm going to turn that into a WARN for now.
We can turn it back into an assert when we fix the original bug. So this is very much a short term measure.
I'll leave this bug open to remind us to change it back.
Simon
comment:2 Changed 5 years ago by igloo
- Milestone set to 6.12 branch
comment:3 Changed 4 years ago by igloo
- Milestone changed from 6.12 branch to 6.12.3
comment:4 Changed 4 years ago by igloo
- Milestone changed from 6.12.3 to 6.14.1
- Priority changed from normal to low
comment:5 Changed 3 years ago by igloo
- Milestone changed from 7.0.1 to 7.0.2
comment:6 Changed 3 years ago by igloo
- Milestone changed from 7.0.2 to 7.2.1
comment:7 Changed 3 years ago by michalt
- Cc michal.terepeta@… added
- Type of failure set to None/Unknown
It seems that the WARN can be changed back to ASSERT. I've tried it on the
example and, as expected, there's a type error (but no violation of assertion).
I've also run validate and everything seems to be fine.
Changed 3 years ago by michalt
comment:8 Changed 3 years ago by michalt
- Status changed from new to patch
comment:9 Changed 3 years ago by simonpj
- Resolution set to fixed
- Status changed from patch to closed
Right, thanks for pointing this out.
Thu Mar 31 11:21:16 BST 2011 simonpj@microsoft.com * Re-enable assertion now the new type checker is in (See Trac #3011.) M ./compiler/typecheck/TcMType.lhs -2 +2
Simon
Snapshot of vector and it's testsuite where ASSERT occured