As documented, rule number 3 throws things off by ignoring the long specification. It also does not quite mention automatically coding a long jump if needed for a locally scoped label (but not an unscoped label). The above fix actually also affected locally scoped labels.
I have a vague recollection from the early days that to reduce the number of short jump errors, the backwards jump automatic handling was introduced. Currently < can be long, and << wouldn't be in much use (except for unscoped, and then usually because long was needed), so yes, it seems like no harm in making it useful for the rest. Just a few more line adjustments also fixed unscoped labels giving the following rearranged clearer rules:
- GoAsm will always code a long jump if specified (for those instructions that support this).
- For backward jumps to unique and also locally scoped labels, GoAsm will automatically code a short jump if possible, if not a long jump.
- For backward jumps to unscoped labels, GoAsm will code a short jump.
- For forward jumps to locally scoped and also unscoped labels, GoAsm will code a short jump.
- For forward jumps to unique labels, GoAsm will code a long jump.