Oxygen Basic

Programming => Bugs & Feature Requests => Topic started by: Laurent on May 23, 2018, 03:16:21 PM

Title: Bug after a simple print in a sub
Post by: Laurent on May 23, 2018, 03:16:21 PM
Testing O2debugger found a bug (last progress version)
With this code the 2 last print are not executed. But if you change "print vshort" by "print str(vshort)" it works.
However in more complex cases it's not enough : more code add to be added.

Code: [Select]
% FileName "test.exe"

sub testsub(vshort as short)
 print vshort
end sub

testsub(12)

print "after sub "

print "pgm exit"
Title: Re: Bug after a simple print in a sub
Post by: Arnold on May 24, 2018, 12:24:23 AM
There are some situations where print does not work quite correctly. This special case can be overcome by using:
 print vshort ""

but I am not sure if this behaviour can be incorporated in Oxygen without producing side effects?
Title: Re: Bug after a simple print in a sub
Post by: Charles Pegge on May 24, 2018, 01:41:13 AM
Hi Laurent,

Thanks. I've found the bug. It is an over-optimisation of procedures without locals. The quick fix is to include a local variable, but I will fix this behaviour ASAP.

PS:

Now fixed. The problem only applied to function calls (within the minimalist sub) with params which are auto-converted from a number to a string.

https://github.com/Charles-Pegge/OxygenBasic/blob/master/OxygenProgress.zip