Not sure if this counts as a bug or not, but I've got the following
program:
import GHC.Exts
import Data.List
wrapper_sum xs = ub_acc_sum xs 0#
ub_acc_sum :: [Int] -> Int# -> Int
ub_acc_sum [] v = I# v
ub_acc_sum ((I# x):xs) v = ub_acc_sum xs (v +# x)
main = do
let l = take 10000000 [1,1..]
seq (last l) $ return ()
putStrLn "unboxed accum"
putStrLn $ show $ wrapper_sum l
When compiled with -O2 or -O1, and -prof and -auto-all, this runs out of
stack space. Without optimisation, it's fine: likewise, without -prof it's
fine, which seems reasonable: AFAICT, ub_acc_sum is tail-recursive.
The slight alteration
wrapper_sum xs = I# (ub_acc_sum xs 0#)
ub_acc_sum :: [Int] -> Int# -> Int#
ub_acc_sum [] v = v
ub_acc_sum ((I# x):xs) v = ub_acc_sum xs (v +# x)
is fine with all combinations of flags.
mrak
--
oh, he's like milk to you
half swedish and half asian
-- Soul Coughing
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs