internal error: evacuate: strange closure type 32768
Greg Buchholz
haskell at sleepingsquirrel.org
Tue May 3 11:21:05 EDT 2005
I'm running GHC v6.4 under Linux (2.6.3) and while trying to port the
spectralnorm benchmark of the Great Computer Language Shootout...
http://shootout.alioth.debian.org/benchmark.php?test=spectralnorm
...I encounter a strange failure mode when turning on optimizations.
For the code below enabling either the -O or -O2 level of optimization
results in the following error...
spectral_norm: internal error: evacuate: strange closure type 32768
Please report this as a bug to glasgow-haskell-bugs at haskell.org,
or http://www.sourceforge.net/projects/ghc/
...using a small value of "n" (say 20 instead of 1999) the unoptimized
version appears to work correctly, while the optimized versions report a
<<loop>>.
Thanks,
Greg Buchholz
-- Spectral Norm benchmark
import Array
import System(getArgs)
main = do
--[arg] <- getArgs
--let n = (read arg) - 1
let n = 1999
let init = listArray (0,n) (repeat 1.0)
let (v:u:rest) = drop 19 $ iterate (eval_AtA_times_u n) init
let vBv = sum [(u!i)*(v!i) |i<-[0..n]]
let vv = sum [(v!i)*(v!i) |i<-[0..n]]
print $ sqrt (vBv/vv)
eval_AtA_times_u n u = eval_At_times_u n v
where v = eval_A_times_u n u
eval_A x y = 1.0/((i+j)*(i+j+1)/2+i+1)
where i = fromIntegral x
j = fromIntegral y
eval_A_times_u n u = accumArray (+) 0 (0,n)
[(i,(eval_A i j) * u!j)|i<-[0..n], j<-[0..n]]
eval_At_times_u n u = accumArray (+) 0 (0,n)
[(i,(eval_A j i) * u!j)|i<-[0..n], j<-[0..n]]
More information about the Glasgow-haskell-bugs
mailing list