Modify

Opened 3 years ago

Closed 2 years ago

#3950 closed Bug (Works For Me)

Silent crash without triggering recursion warning

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.16.0 Severity: None
Keywords: Cc:

Description

https://www.autoitscript.com/forum/topic/209971-haskell-like-recursive-map/?do=findComment&comment=1515960

AutoIt triggers recursion warning and exits when you reach a recursion depth of 1898, but in some instances it would fail to trigger the warning and instead simply crash silently.

I'm not certain whether it is a bug with AutoIt itself or if it is simply the Operating System terminating it defensively, it's worth investigating.

Attachments (0)

Change History (6)

comment:1 by J-Paul Mesnage, 3 years ago

Hi in fact the pointed post script does not produce any error on my system
could you post an updated one?

Thanks

in reply to:  1 ; comment:2 by anonymous, 3 years ago

Replying to Jpm:

Hi in fact the pointed post script does not produce any error on my system
could you post an updated one?

Thanks

That's the problem, it did not produce an error when it should have. The script just crashes without producing a result. Did your system produce a result MsgBox, or did it just exit silently?

in reply to:  2 comment:3 by anonymous, 3 years ago

Replying to anonymous:

Replying to Jpm:

Hi in fact the pointed post script does not produce any error on my system
could you post an updated one?

Thanks

That's the problem, it did not produce an error when it should have. The script just crashes without producing a result. Did your system produce a result MsgBox, or did it just exit silently?

That is, if you change 1569 to a larger number.

comment:4 by anonymous, 3 years ago

For your convenience, here's a tweaked version that crashes silently:

local $a = enumerate(1570)
local $b = packLeft($a)
local $c = packRight($a)
msgbox(0,'foldl',foldl(addOddLeft,0,$b))
msgbox(0,'foldr',foldr(addOddRight,$c,0))


func addOddLeft($left, $right)
     return $left + ($right*2 - 1)
endfunc

func addOddRight($left, $right)
     return ($left*2 - 1) + $right
endfunc

func foldl($f, $x0, $xs)
     return IsArray($xs[0]) ? $f( foldl($f,$x0,$xs[0]) , $xs[1] ) : $f($x0,$xs[0])
endfunc

func foldr($f, $xs, $x0)
     return IsArray($xs[0]) ? $f( $xs[1] , foldr($f,$xs[0],$x0) ) : $f($xs[0],$x0)
endfunc

func foldl_FromFlatArray($f, $ini, $arr)
     return foldl($f,$ini,packLeft($arr))
endfunc

func foldr_FromFlatArray($f, $arr, $ini)
     return foldr($f,packRight($arr),$ini)
endfunc

func packLeft($arr)
     return __packL($arr,UBound($arr)-1)
endfunc

func packRight($arr)
     return __packR($arr,0)
endfunc

func unpack($arr)
     return IsArray($arr[0]) ? $arr[1] & ' , ' & unpack($arr[0]) : $arr[0]
endfunc

; === Boring Internal Implementation ===

func __packL($arr, $index)
     if $index>0 Then
        local $a = [ __packL($arr,$index-1) , $arr[$index]]
     else
        local $a = [ $arr[0] ]
     endif
     return $a
endfunc

func __packR($arr, $index)
     if $index<UBound($arr)-1 Then
        local $a = [ __packR($arr,$index+1) , $arr[$index] ]
     else
        local $a = [ $arr[UBound($arr)-1] ]
     endif
     return $a
endfunc

func enumerate($n)
     local $arr[$n]
     for $i=0 to $n-1
         $arr[$i] = $i+1
     next
     return $arr
endfunc
Last edited 3 years ago by mLipok (previous) (diff)

comment:5 by J-Paul Mesnage, 3 years ago

Hi, your script produce 2 msgbox and stop gracefully
soI don't see any pb

comment:6 by J-Paul Mesnage, 2 years ago

Resolution: Works For Me
Status: newclosed

No answer to I close the ticket

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.