Bugs item #746077, was opened at 2003-05-30 16:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=746077&group_id=8032

Category: Compiler
Group: 5.02
Status: Open
Resolution: None
Priority: 5
Submitted By: Nyk�nen, Matti (mnykanen)
Assigned to: Nobody/Anonymous (nobody)
Summary: GHCi 5.02.3 dumps core

Initial Comment:
(My e-mail is [EMAIL PROTECTED], just in
case my new SourceForge registration has problems.)

I get the following erratic behaviour - a SIGSEGV from
GHCi.
(The OS is some variant of Red Hat in use here at CS.
Dept of University of Helsinki (the birthplace of
Linux). The hardware is some generic Intel-based
desktop PC.)

----------------------------------------------------------------------------
valkokari$ ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version
5.02.3, for Haskell 98.
/ /_\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package std ... linking ... done.
Prelude> :l SegFault
Compiling SegFault         ( SegFault.hs, interpreted )
Ok, modules loaded: SegFault.
SegFault> insert 1 2 None
Segmentation fault
valkokari$
---------------------------------------------------------------------------

The file I loaded is as follows (I hope the
xEmacs-generated
indentation came through):

---------------------------------------------------------------------------
module SegFault where

data Color = Red 
           | Black
             deriving Show

data Ord k => Tree k d = None 
                       | Node{color::Color,
                              key::k,
                              item::d,
                              left::(Tree k d),
                              right::(Tree k d)}
                         deriving Show

insert k i t = (insert2 t) {color=Black}
    where insert2 None = Node{color=Red,
                              key=k,
                              item=i,
                              left=None,
                              right=None}
---------------------------------------------------------------------------

If write "where insert2 x = ..." instead, I get
something different (which may make more sense to you
than me):

---------------------------------------------------------------------------
valkokari$ ghci
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version
5.02.3, for Haskell 98.
/ /_\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package std ... linking ... done.
Prelude> :l BadEta.hs
Compiling BadEta           ( BadEta.hs, interpreted )
Bad eta expand
    (\ k{-aX8-} d{-aXa-} t_aXm zddOrd{-aXr-} ->
       let {
         zdmNode{-aWS-}
           = \ eta_s1e7 eta_s1e9 eta_s1eb eta_s1ed
eta_s1ef ->
               BadEta.Node{-rRX-}
                 @ k{-aX8-}
                 @ d{-aXa-}
                 zddOrd{-aXr-}
                 eta_s1e7
                 eta_s1e9
                 eta_s1eb
                 eta_s1ed
                 eta_s1ef
       } in
         \ k{-rS6-} i{-rS7-} t{-rS8-} tpl_X1J ->
           BadEta.zdwNode{-rSs-}
             @ k{-aX8-}
             @ d{-aXa-}
             k{-rS6-}
             i{-rS7-}
             (BadEta.zdwNone{-rSr-} @ k{-aX8-} @ d{-aXa-})
             (BadEta.zdwNone{-rSr-} @ k{-aX8-} @ d{-aXa-})
             tpl_X1J)
      @ k{-aX8-} @ d{-aXa-} @ t_aXm eta_s1ei eta_s1eA
eta_s1eC eta_s1eE
    BadEta.Tree{-rRL-} k{-aX8-} d{-aXa-}
Ok, modules loaded: BadEta.
BadEta> insert 1 2 None
Segmentation fault
valkokari$
--------------------------------------------------------------------------

That is, then GHCi first complains about a bad eta
expansion, but nevertheless claims to have successfully
loaded the module, but still ends up crashing.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=746077&group_id=8032
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to