Modify

#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 follow-up: Changed 20 months ago by Jpm

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

Thanks

comment:2 in reply to: ↑ 1 ; follow-up: Changed 20 months ago by 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?

comment:3 in reply to: ↑ 2 Changed 20 months ago by anonymous

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 Changed 20 months ago by anonymous

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 20 months ago by mLipok (previous) (diff)

comment:5 Changed 20 months ago by Jpm

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

comment:6 Changed 10 months ago by Jpm

  • Resolution set to Works For Me
  • Status changed from new to closed

No answer to I close the ticket

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.