#4187: Seg fault with Text.Regex
------------------------+---------------------------------------------------
    Reporter:  kfisher  |       Owner:                
        Type:  bug      |      Status:  new           
    Priority:  normal   |   Component:  Runtime System
     Version:  6.13     |    Keywords:                
          Os:  MacOS X  |    Testcase:                
Architecture:  x86      |     Failure:  GHCi crash    
------------------------+---------------------------------------------------
 I have been seeing ghci seg fault, hang, or exit with the error:
 "<interactive>: memory allocation failed (requested 1948254208 bytes)"
 when loading the following program into ghci (version 6.13.20100309) and
 asking for the value of re_result1:[[BR]]




 {{{
 module Examples.RegExpTest where

 import qualified Text.Regex as RE

 re = RE.mkRegexWithOpts "^a+" True True
 re_results1 = RE.matchRegexAll re "aaaab"

 }}}


 Here is a sample session:


 {{{
 babylon-2:/Users/kfisher/pads/dirpads/src>~/sw/ghc-head/bin/ghci
 GHCi, version 6.13.20100309: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Prelude> :l Examples/RegExpTest.hs
 [1 of 1] Compiling Examples.RegExpTest ( Examples/RegExpTest.hs,
 interpreted )
 Ok, modules loaded: Examples.RegExpTest.
 *Examples.RegExpTest> re_results1
 Loading package array-0.3.0.0 ... linking ... done.
 Loading package bytestring-0.9.1.5 ... linking ... done.
 Loading package containers-0.3.0.0 ... linking ... done.
 Loading package mtl-1.1.0.2 ... linking ... done.
 Loading package regex-base-0.93.1 ... linking ... done.
 Loading package regex-posix-0.94.1 ... linking ... done.
 Loading package regex-compat-0.93.1 ... linking ... done.
   C-c C-cInterrupted.
 *Examples.RegExpTest> re_results1
 Segmentation fault

 }}}


 The first time I asked for the value of re_result1 in the session above,
 the system seemed to go into an infinite loop, which I interrupted after
 about a minute.   The second time, the system seg faulted.   Sometimes,
 the system does return a value.  For example, the first time I tried the
 above experiment after upgrading to Text.Regex version 0.93.  However, it
 returned the value:[[BR]]



 {{{
 Just
 
("","aaaa","b",["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",[[BR]]
 "","","","","","","","","","","","","","",""])

 }}}

 Another time, it returned the value:[[BR]]



 {{{
 Just ("","aaaa","b",[])

 }}}

 which is what I was expecting.   The first of these was run with a
 different set of command-line flags to ghci, so maybe that explains the
 value difference.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4187>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to