Hi Michael

On 22 Feb 2012, at 13:31, Michael Bulford wrote:

> There is an error in the Turbo parser at line 14490.  Here is this line:
>  
> 14490  IF var%>0
> AND (struct%(var%)&&directive_mask%)=directive_mask%
>  
> Both sides of the "AND" get to be evaluated.  Although var% is tested for 
> being non
> negative on the left hand side, the right hand side will be evaluated in any
> event.  Should var% happen to be
> negative, then struct%(var%) would be outside of the array bounds and will
> crash SuperBASIC.

You are quite right. But how did you get var%=-3? Does this imply another 
mistake in Parser?

>   The above line needs
> to be re written so that the right hand side will only be evaluated if the 
> left
> hand side evaluates to true.  Here is my
> suggested work-around:
>  
> 14444  LOCal both :
> REMark (if needed)
> 14488  both = 0
> 14489  IF var%>0:IF
> (struct%(var%)&&directive_mask%)=directive_mask% : both = 1
> 14490  IF both
>  

My solution is:

14490 IF var%>0
14494  IF (struct%(var%)&&directive_mask%)=directive_mask%:Parse_Directive:ELSE 
Skip_Stmt

Cheers

George
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to