Bug #347
closedFunction problem. The third time any user-defined function is called, AOZ will lock up.
0%
Description
In the following example, I'm trying to re-define Instr to allow for a negative startingPosition parameter.
The function works fine with any one or two of the following.
If, however, the function is called a third time, the program will freeze.
Function "instr",st$,fnd$,strt
result=0
If Abs(strt)<=Len(st$)
If strt < 0
startPos=Len(st$)-(abs(strt)-1)
For p=startPos to 1 Step -1
If Mid$(st$,p,Len(fnd$))=fnd$ Then result=p:Exit
Next p
Else
For p=strt To Len(st$)
If Mid$(st$,p,Len(fnd$))=fnd$ Then result=p:Exit
Next p
End If
End If
End Function(result)
Any one or two of the following examples will work fine, but if you try a third one AOZ will freeze.
Print instr(inst$," ",1) ' result 5
Print instr(inst$," ",-1) ' result 35
Print instr(inst$," ",6) ' result 10
Print instr(inst$," ",-8) ' result 29
Print instr(inst$," ",40) ' result 0
Print instr(inst$," ",-40) ' result 0
Updated by Brian Flanagan over 4 years ago
- Subject changed from Function works inconsistently. to Function problem. The third time any user-defined function is called, AOZ will lock up.
NOTE: Further testing indicates that the 3rd time ANY user defined function is called, it will lock up AOZ.
Here's another example:
/*
Leap Year
Parameter: y 4-digit year
Returns: Leap Year (1=leap, 0=not) ' Yes, there's a reason for 0 or 1
*/
Function "LeapYear",y
ly=0
If y=4*Int(y/4) Then ly=1
If y=100*Int(y/100) Then ly=0
If y=400*Int(y/400) THen ly=1
End Function(ly)
Again, any 1 or 2 of these works, but as soon as the third one is called, AOZ fails.
Print LeapYear(1980) ' should return 1
Print LeapYear(1983) ' should return 0
Print LeapYear(2020) ' should return 1
Print LeapYear(2021) ' should return 0
It could also be a combination of more than one user defined function.
Updated by Brian Flanagan over 4 years ago
- Affected version changed from 0.9.8.1 to 0.9.9.2
Re-tested in 0.9.9.2. Still fails.
Changed affected version from 0.9.8.1 to 0.9.9.2 accordingly.
Updated by Brian Flanagan over 4 years ago
- Affected version changed from 0.9.9.2 to 0.9.9.3
Re-tested in 0.9.9.3. Problem still exits.
Updated by Francois Lionet about 4 years ago
- Status changed from New to Resolved
- Target version set to 0.9.9.4-r2
Fixed! The transpiler was completely lost at one stage...
Updated by Brian Flanagan about 4 years ago
- Status changed from Resolved to Closed
Tested again in Beta RC3. Working!