selfhost/cmd/w6a: align parsenum to strtoll(base 0) semantics (#62)
w6a's parsenum diverged from the C twin's strtoll(s,end,0)
(cmd/w6a/lex.c:30) on three hand-written-asm edge shapes (all
gate-blind — w6c emits the canonical $5/$8/-8(BP), never these):
(a) `$ 5` — leading whitespace: strtoll skips it (->5); ww had no
skip and silently encoded imm 0.
(b) `$08` — strtoll base-0 reads a leading 0 as octal, stops at '8'
(->0); ww parsed it as decimal 8.
(c) `-(BP)` — strtoll/cstage require a digit after the sign, so a bare
`-(` is unrecognised operand; ww silently took it as 0(BP).
Add the whitespace skip + octal base-0 detection to parsenum, and the
digit-after-sign guard to the operand scanner — both assemblers now
agree byte-for-byte (a/b) and both reject (c).
Not a Hare item (w6a is ww's plan9-lineage assembler); reference is the
C strtoll twin. w6a embeds into its own combined.ww snapshot; regen'd.
530_w6a_parsenum pins the byte-identity + both-reject matrix.
This commit is contained in:
10
Makefile
10
Makefile
@@ -230,7 +230,8 @@ $(BIN) $(LIB) $(OBJ)/wcc $(OBJ)/ww $(OBJ)/wwdump $(OBJ)/w6c $(OBJ)/w6a $(OBJ)/w6
|
||||
# ---- tests -------------------------------------------------------------
|
||||
# Each phase adds a $(BIN)/test_<name> target; the runner walks them.
|
||||
TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_w6c $(BIN)/test_w6a $(BIN)/test_dataw $(BIN)/test_datar \
|
||||
$(BIN)/test_w6c $(BIN)/test_w6a $(BIN)/test_w6a_parsenum \
|
||||
$(BIN)/test_dataw $(BIN)/test_datar \
|
||||
$(BIN)/test_w6l $(BIN)/test_data_link \
|
||||
$(BIN)/test_arch \
|
||||
$(BIN)/test_e2e $(BIN)/test_ffi $(BIN)/test_dyn $(BIN)/test_stdlib \
|
||||
@@ -614,6 +615,13 @@ $(BIN)/test_w6a: test/wcc/500_w6a.c $(BIN)/w6c $(BIN)/w6a | $(BIN)
|
||||
$(BIN)/test_dataw: test/wcc/510_dataw.c $(BIN)/w6a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 530_w6a_parsenum (F14 #62): w6a vs w6a_ww must agree on strtoll-edge
|
||||
# immediate shapes ($ 5 / $08) and both reject a bare -(BP). Needs both
|
||||
# assembler twins.
|
||||
$(BIN)/test_w6a_parsenum: test/wcc/530_w6a_parsenum.c $(BIN)/w6a $(BIN)/w6a_ww \
|
||||
| $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_datar: test/wcc/520_datar.c $(BIN)/w6a $(BIN)/w6l | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
|
||||
Reference in New Issue
Block a user