TI-Toolkit / tibo

source-to-source optimizer for TI-BASIC
https://ti-toolkit.github.io/tibo/
2 stars 1 forks source link

Deleting unused labels is not always valid #1

Open rpitasky opened 2 weeks ago

rpitasky commented 2 weeks ago

Consider

If A
Lbl B
Disp "C

If Lbl B is blindly deleted, then the program will look like this:

If A
Disp "C

In this program, Disp "C will not run if A is false. Currently, tibo is very happy to delete Lbl B.

anujkumardarji commented 2 weeks ago

@rpitasky, hello! How are you? I understand the problem you described and the potential issues that can arise:

Conditional Execution: The output will only occur if a specific condition is true. Loss of Control Flow: Removing the label could disrupt the intended flow of the program. Potential Bugs: Blindly deleting the line might introduce unforeseen bugs.

Could you explain a bit more about how to fix this bug?