Forum
warning: [W180] Unreachable code problem? - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: warning: [W180] Unreachable code problem? (/showthread.php?tid=1420)



warning: [W180] Unreachable code problem? - maeloterkim - 09-10-2021

Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub



RE: warning: [W180] Unreachable code problem? - RandomiserUsr - 09-12-2021

(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks


RE: warning: [W180] Unreachable code problem? - maeloterkim - 09-13-2021

(09-12-2021, 09:10 PM)RandomiserUsr Wrote:
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks





if i fill the sub like this




sub mySub()




   dim a as ubyte


   dim b as ubyte



   a = 1


   b = 1


   a = a + b




end sub




the problem is the same I writed an empty sub only as a example I found the problem in first time with not empty sub



and where is the escape from the loop?  i don't see it

is a very very little structure.  Just one goto, one for and one sub


RE: warning: [W180] Unreachable code problem? - RandomiserUsr - 09-13-2021

(09-13-2021, 10:15 AM)maeloterkim Wrote:
(09-12-2021, 09:10 PM)RandomiserUsr Wrote:
(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Looks like there is escape from the loop? 
and an empty mySub() ?

Thanks





if i fill the sub like this




sub mySub()




   dim a as ubyte


   dim b as ubyte



   a = 1


   b = 1


   a = a + b




end sub




the problem is the same I writed an empty sub only as a example I found the problem in first time with not empty sub



and where is the escape from the loop?  i don't see it

is a very very little structure.  Just one goto, one for and one sub

Hi, sorry I missed off some of the message.

I can't see how this myBuckle loop would exit?

myBucle:
for myNumber = 0 to 7
mySub()
next myNumber
goto myBucle

Lastly what is the full code listing and full error you are getting?


RE: warning: [W180] Unreachable code problem? - boriel - 09-13-2021

(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

This is a bug. It's an spurious (wrong) warning.
I'll let you know when I fix it. Thanks for reporting!
Shy


RE: warning: [W180] Unreachable code problem? - boriel - 09-24-2021

(09-10-2021, 06:17 PM)maeloterkim Wrote: Hi  if i compile this, says

warning: [W180] Unreachable code

but i don't know why


the version is  zxbasic-1.15.2





Code:
' EXAMPE UNRECHABLE CODE

declare sub mySub()

Dim myNumber As uByte
cls

myBucle:
    for myNumber = 0 to 7          
        mySub()                  
    next myNumber
    goto myBucle

sub mySub()

end sub

Ok, try this new beta version and tell me Shy  (download the one appropriate for you, which, I guess, will mostly be win32):

http://www.boriel.com/files/zxb/zxbasic-1.15.3-beta13.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.15.3-beta13.zip
http://www.boriel.com/files/zxb/zxbasic-1.15.3-beta13-win32.zip
http://www.boriel.com/files/zxb/zxbasic-1.15.3-beta13-linux64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.15.3-beta13-macos.tar.gz