Crash on windows for simple substitution
Status: Beta
Brought to you by:
laboratoryman
The folllowing code crashes when run on windows
module Main where import qualified Text.Regex as Re -- from regex-compat import Debug.Trace main :: IO () main = do putStr $ cleanWord "jan" putStr $ cleanWord "dec" putStr $ cleanWord "jun" -- crashes here cleanWord :: String -> String cleanWord word_ = let word = trace (show word_) word_ in let re = Re.mkRegexWithOpts "(jun|jul|aug|sep|oct|nov|dec)" True False in Re.subRegex re word ""
It crashes when it gets to the "jun" text. If I move the jun alt to the end of the list then it works fine
I created a SO question while trying to work this out
http://stackoverflow.com/questions/39047317/simple-regular-expression-substitution-crashes-on-windows-using-regex-compat/39101634#39101634
Feedback from there was the following
It's a bug, probably in regex-posix, due to its difference in the inclusion of the underlying BSD regex library from 1994. In sslow, an invalid memory address (-1(%rdx) with rdx = 0) will be accessed.
Thanks