|
|
| Author |
Message |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 23 December 2006, 16:24 PM Post subject: Function Return Optimization Bug |
|
|
The following example code shows the problem:
| Code: | Private i as Integer
Private x as Byte
Sub Main()
i = 20
Debug.Print CStr(i)
Call Func()
' Problem shows up with value of i is unchanged by call to Func
Debug.Print CStr(i)
End Sub
Public Sub Func()
i = SetCode()
' Uncomment the following line and Main prints the correct result
'Debug.Print CStr(i)
End Sub
Function SetCode() as Integer
SetCode = 3
' wrong code generated for line above (value not saved on stack)
' the following line is needed to see the problem
x = 23
End Function |
The two Debug.Print statements in Main() show the same value. Uncommenting the line in Func() shows the correct result of 20 and then 3. |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2493
Location: Portland, OR
|
|
Posted: 28 December 2006, 4:34 AM Post subject: |
|
|
| The cause of this problem has been isolated and a solution has been implemented. It is currently in the process of being tested. |
|
| Back to top |
|
 |
|