SPRUI03E June 2015 – January 2023
This is an example of code that declares and uses a local label legally:
$1:
SUB A1,1,A1
[A1] B $1
SUBC A3,A0,A3
NOP 4
.newblock ; undefine $1 to use it again
$1 SUB A2,1,A2
[A2] B $1
MPY A3,A3,A3
NOP 4
The following code uses a local label illegally:
$1:
SUB A1,1,A1
[A1] B $1
SUBC A3,A0,A3
NOP 4
$1 SUB A2,1,A2 ; WRONG - $1 is multiply defined
[A2] B $1
MPY A3,A3,A3
NOP 4
The $1 label is not undefined before being reused by the second branch instruction. Therefore, $1 is redefined, which is illegal.