Bug #400
Un-referenced line numbers sometimes cause Gosub to fail.
Start date:
06/27/2020
Due date:
% Done:
0%
Estimated time:
1:00 h
Affected version:
Description
Example:
#manifest: "pc" #splashScreen: false #speed: "safe" #fps: false Gosub 20 ' This program freezes (and produces no output) if line 5 exists, but is not referenced. ' If you comment line 5, both Gosubs (20 & 15) work. Gosub 15 ' Gosub 5 ' If you UN-comment this line, and leave line 5 active, then all 3 Gosubs will work. End 5 Print "Line 5" Return 15 Print "Line 15" Return 20 Print "Line 20" Return
NOTE: It doesn't have to be an un-referenced Gosub... but instead, ANY un-referenced line number.
NOTE ALSO: If the un-referenced line appears AFTER lines 10, 15, and 20, this is NOT a problem.
AND: If the un-referenced line appears before ANY of lines 10, 15, and 20, the program will fail.
HERE IS THE KEY TO SOLVING THE PROBLEM:
If an un-referenced line number appears before a referenced subroutine, the program will fail.
If you add a reference to the un-referenced line, OR you comment the un-referenced line, this will work-around the problem.
An un-referenced line number should be a WARNING only, and should NOT cause the code to fail.