#2818: schedule: invalid what_next field
---------------------+------------------------------------------------------
Reporter: kkwweett | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 6.10.1 | Severity: normal
Keywords: schedule | Testcase:
Os: Windows | Architecture: x86
---------------------+------------------------------------------------------
= internal error: schedule: invalid what_next field =
I'm studying a program which runs without trouble within ghci but fails to
run well once compiled with ghc --make.
* The program
* The error message
* The ways I get or not the error message
== The program ==
It is a computing of the index for which the length of the longuest
sequence during a Syracuse process [(/2) if even u, (+1).(*3) if odd u] is
reached.
''boundary'' variable is the only parameter.
For instance, the program returns '''3''' for
{{{
boundary=5
}}}
because [[BR]]
the 1-process [1->] has 0 element, [[BR]]
the 2-process [2->1] has 1 element, [[BR]]
the 3-process [3->10,5,16,8,4,2,1] has 7 elements, [[BR]]
the 4-process [4->2,1] has 2 elements and [[BR]]
the 5-process [5->16,8,4,2,1] has 5 elements [[BR]]
so the index for which the maximum is reached is '''3''' (for a length
maximum of 7).
{{{
-- syracuse.hs
import Data.Array
import Data.Ord
boundary=25999
maximumBy g x = fst $ (foldr (maxBy g) (0,0) x)
maxBy comp x y=case (comp x y) of
GT -> x
EQ -> y
LT -> y
syrs n = a
where a = listArray (1,n) $ 0:[ syr x | x <- [2..n]]
syr x = if x' <= n then 1 + a ! x' else 1 + syr x'
where x' = if even x then x `div` 2 else 3 * x + 1
main = print $ maximumBy (comparing snd)$ assocs $ syrs boundary
}}}
== The error message ==
syracuse.exe: internal error: schedule: invalid what_next field [[BR]]
(GHC version 6.10.1 for i386_unknown_mingw32)[[BR]]
Please report this as a GHC bug:
http://www.haskell.org/ghc/reportabug [[BR]]
This application has requested the Runtime to terminate it in an unusual
way. [[BR]]
Please contact the application's support team for more information. [[BR]]
== The ways I get or not the error message ==
I'm running Windows XP SP3 on a ~1GHz CPU/ ~1Go RAM computer.[[BR]]
Within ghci, I'm only limited by memory (I get an *** Exception : stack
overflow for boundary=140000) and I can compute up to
{{{
boundary=130000
}}}
for which the program returns '''106239'''.
On the other hand, when I compile using
{{{
ghc --make syracuse
}}}
everything 's all right up to boundary=25998 (result:'''23529''', Exit
code: 0 ) but as far as boundary>25998, the program displays the result
(for instance I can get '''106239''' again) but the error message is also
displayed with Exit code: 3.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2818>
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