Compiler dying with message `dart' when fusion turned on

View: New views
2 Messages — Rating Filter:   Alert me  

Compiler dying with message `dart' when fusion turned on

by Vag Vagoff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Compiler dying with very strange message `drat' on black screen when
fusion turned on:

module utf

Start = 1

import StdEnv, StdMaybe

class indexBy i a e :: (a e) i -> e

:: Utf8Str a
    = Utf8Compressed !{Int}
    | Utf8Indexed !{Int} !{#Int}

:: Utf8Char = { uc :: !Int }

instance == Utf8Char where (==) {uc=a} {uc=b} = a == b

instance AsString (Utf8Str Utf8Char)
where
    substring str sub = searchSubstring str sub

searchSubstring str sub
    = search str 0 sub 0
where
    search s i0 u j
        #! i = i0 + j
        | indexBy s i == indexBy u j = search s (i0 + 1) u 0
        = search s i0 u (j + 1)

instance indexBy Int Utf8Str Utf8Char
where
    indexBy a=:(Utf8Compressed _) i = indexBy a i
    indexBy a=:(Utf8Indexed _ is) i = indexBy a i

class AsString s
where
    substring :: s s -> Maybe Int


(all options are by defaut except `fusion')

_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Re: Compiler dying with message `dart' when fusion turned on

by John van Groningen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Vag wrote:
>Compiler dying with very strange message `drat' on black screen when fusion turned on:
>
>..

This happens beacuse of a bug in the fusion algorithm in the compiler.
The problem may occur if a recursive function with more than one
recursive call (in this case indexBy) is fused with a case
(| indexBy s i == indexBy u j).
If have fixed this in the development version of the compiler.

A possible workaroud is to replace:

       | indexBy s i == indexBy u j = search s (i0 + 1) u 0

by:

       #! si = indexBy s i
       #! ui = indexBy u j
       | si == ui = search s (i0 + 1) u 0

Kind regards,

John van Groningen
_______________________________________________
clean-list mailing list
clean-list@...
http://mailman.science.ru.nl/mailman/listinfo/clean-list