Add one more test case, to demonstrate that it's not just output.
Chris Pressey
6 years ago
1606 | 1606 | | } |
1607 | 1607 | = ok |
1608 | 1608 | |
1609 | If a location is initialized in one block, is must be initialized in the other as well | |
1609 | If a location is initialized in one block, it must be initialized in the other as well | |
1610 | 1610 | in order to be considered to be initialized after the block. If it is not consistent, |
1611 | 1611 | it will be considered uninitialized. |
1612 | 1612 | |
1651 | 1651 | | } |
1652 | 1652 | | } |
1653 | 1653 | ? UnmeaningfulOutputError: x |
1654 | ||
1655 | | define foo routine | |
1656 | | inputs a | |
1657 | | trashes a, x, z, n, c | |
1658 | | { | |
1659 | | cmp a, 42 | |
1660 | | if not z { | |
1661 | | ld a, 6 | |
1662 | | } else { | |
1663 | | ld x, 7 | |
1664 | | } | |
1665 | | ld a, x | |
1666 | | } | |
1667 | ? UnmeaningfulReadError: x | |
1654 | 1668 | |
1655 | 1669 | If we don't care if it's uninitialized after the `if`, that's okay then. |
1656 | 1670 |