Re: Strange machine-level exception

new topic     » goto parent     » topic index » view thread      » older message » newer message

Juergen Luethje wrote:
> 
> Hi all,
> 
> I've changed my private create_set() function a little, in order to take
> advantage of find_from(). Then I encountered a strange machine-level
> exception.
> 
> I've tested it on Windows XP Pro and Euphoria 3.1. The following code runs
> fine when interpreted by EX.exe, EXW.exe and EXWC.exe. When I uncomment
> the denoted line near the end, the program still runs fine with EX.exe but
> crashes reliably with EXW.exe and EXWC.exe. Renaming "safe.e" to "machine.e"
> and including it in the program didn't provide any hints.
> }}}
<eucode>
> function create_set (sequence s)
>    -- create a set (= remove duplicate entries)
>    integer p
> 
>    if length(s) < 2 then
>       return s
>    end if
> 
>    p = length(s)
>    for i = length(s)-1 to 1 by -1 do
>       if find_from(s[i], s, i+1) = 0 then  -- Machine-level exception here ...
>          p -= 1
>          s[p] = s[i]
>       end if
>    end for
>    return s[p..$]
> end function
> 
> 
> sequence freq, result, unique
> integer n, player
> 
> n = 1000
> 
> result = {}
> for i = 1 to n do
>    freq = repeat(0, 3)
>    for card = 1 to 4 do
>       player = rand(3)
> --       freq[player] += 1                 -- ... after uncommenting this
> line!
>    end for
>    result = append(result, freq)
> end for
> 
> unique = create_set(result)
> ? unique
> if getc(0) then end if
> </eucode>
{{{

> Can someone please confirm the problem?
> 
> Regards,
>    Juergen

I just ran the above code as is. Under ex.exe, exw.exw and exwc.exe, the same
result is obtained:
{
 {0,0,0}
}

This was under XP Home SP2, P4 Intel 3.0GHz, 1Go RAM
I just downloaded and executed e31setup.exe.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu