Quantcast

GHC Crash

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

GHC Crash

Matt-47
Hello,

I found a bug in GHC which causes it to crash. I believe it is related to my
experimentation with the unboxed tuple. It was not clear to me from the
manual as to whether or not this was legal. My version of GHC reports via -v
that it is "Glasgow Haskell Compiler, Version 6.4.1, for Haskell 98,
compiled by GHC version 6.4". I am running on Windows XP.

A simplified repro of the bug follows:

{-# OPTIONS_GHC -fglasgow-exts #-}

import qualified Array;
import qualified Ix;

type Array a b = Array.Array a b
type Matrix a b = Array (a, a) b

-- Imports from Array.Array for convenience
(!) :: Ix.Ix a => Array a b -> a -> b
(!) = (Array.!)

fweval :: (Ix.Ix a, Integral b) => Matrix a (Maybe b) -> a -> a -> a ->
[((a, a), Maybe b)] -> [((a, a), Maybe b)]
fweval m i j k upd = case (# m!(i, k), m!(k, j), m!(i, j) #) of
                      (# Nothing, _, _ #)             -> upd
                      (# _, Nothing, _ #)             -> upd
                      (# Just ik, Just kj, Nothing #) -> ((i, j), Just
(ik+kj)):upd
                      (# Just ik, Just kj, Just ij #) -> if (ik+kj) < ij
then ((i, j), Just (ik+kj)):upd else upd

main :: IO ()
main = return ()

-Matt

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: GHC Crash

Simon Peyton Jones
It's a delicate area, but yes I think it should work.  It does now, in
the HEAD.

Simon

| -----Original Message-----
| From: Simon Marlow
| Sent: 23 November 2005 12:39
| To: Simon Peyton-Jones
| Cc: Matt
| Subject: RE: GHC Crash
|
| Simon - this one reports
|
| ghc-6.5.20051122: panic! (the `impossible' happened, GHC version
6.5.20051122):
|         dsLExpr: tuple pattern:
| [ etc. ]
|
| it looks like the typechecker should be catching the use of unboxed
tuple in a case scrutinee.  Is GHC
| supposed to do that these days?
|
| (see ~simonmar/scratch/test373.hs)
|
| Cheers,
| Simon
|
| On 20 November 2005 04:39, Matt wrote:
|
| > Hello,
| >
| > I found a bug in GHC which causes it to crash. I believe it is
| > related to my experimentation with the unboxed tuple. It was not
| > clear to me from the manual as to whether or not this was legal. My
| > version of GHC reports via -v that it is "Glasgow Haskell Compiler,
| > Version 6.4.1, for Haskell 98, compiled by GHC version 6.4". I am
| > running on Windows XP.
| >
| > A simplified repro of the bug follows:
| >
| > {-# OPTIONS_GHC -fglasgow-exts #-}
| >
| > import qualified Array;
| > import qualified Ix;
| >
| > type Array a b = Array.Array a b
| > type Matrix a b = Array (a, a) b
| >
| > -- Imports from Array.Array for convenience
| > (!) :: Ix.Ix a => Array a b -> a -> b
| > (!) = (Array.!)
| >
| > fweval :: (Ix.Ix a, Integral b) => Matrix a (Maybe b) -> a -> a -> a
| > -> [((a, a), Maybe b)] -> [((a, a), Maybe b)]
| > fweval m i j k upd = case (# m!(i, k), m!(k, j), m!(i, j) #) of
| >                       (# Nothing, _, _ #)             -> upd
| >                       (# _, Nothing, _ #)             -> upd
| >                       (# Just ik, Just kj, Nothing #) -> ((i, j),
Just
| > (ik+kj)):upd
| >                       (# Just ik, Just kj, Just ij #) -> if (ik+kj)
<
| > ij then ((i, j), Just (ik+kj)):upd else upd
| >
| > main :: IO ()
| > main = return ()
| >
| > -Matt
| >
| > _______________________________________________
| > Glasgow-haskell-bugs mailing list
| > [hidden email]
| > http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Loading...