word_source: repair DECAY-RATE@ overflow guard and remove dead shadowed registrations
DECAY-RATE@ (physics_freeze_words.c) pushed to the data stack with no capacity check and no prior pop to make room, unlike its neighbors in the same file -- the one live, unconditional missing-guard bug the Isabelle sweep's ~15 candidate findings reduced to once checked against vm_push()'s real internal bounds check (see proof/FINDINGS.md SS2). Removed dictionary_manipulation_words.c's [ ] STATE and defining_words.c's DEFER IS DEFER@ (plus the now-orphaned defining_runtime_defer helper) -- all confirmed permanently shadowed by later dictionary registrations (defining_words.c and defer_words.c respectively), per FORTH's newest-first lookup. No behavior change: the removed code was already unreachable. Verified: hosted `make` builds clean under -Wall -Werror; the hosted self-test suite passes 965/965 implemented tests with no regressions. Three-architecture QEMU acceptance boot, all clean to ok> with an identical dict_hash=0x24b4279f0670aa3a across amd64/aarch64/riscv64 and identical 1003/965/0/0 test totals -- logs attached. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3426d6a4a7
commit
dfdabcc2d7
@@ -111,35 +111,6 @@ static char *traverse_name_field(char *name_addr, int direction) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FORTH word [ - Enter interpretation mode
|
||||
* @param vm Pointer to VM instance
|
||||
* @stack ( -- )
|
||||
*/
|
||||
void dictionary_m_word_left_bracket(VM *vm) {
|
||||
vm->mode = MODE_INTERPRET;
|
||||
state_variable = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FORTH word ] - Enter compilation mode
|
||||
* @param vm Pointer to VM instance
|
||||
* @stack ( -- )
|
||||
*/
|
||||
void dictionary_m_word_right_bracket(VM *vm) {
|
||||
vm->mode = MODE_COMPILE;
|
||||
state_variable = -1; /* FORTH-79 uses -1 for true */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FORTH word STATE - Get compilation state variable address
|
||||
* @param vm Pointer to VM instance
|
||||
* @stack ( -- addr )
|
||||
*/
|
||||
void dictionary_m_word_state(VM *vm) {
|
||||
vm_push(vm, (cell_t)(uintptr_t) & state_variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FORTH word SMUDGE - Toggle smudge bit of latest word
|
||||
* @param vm Pointer to VM instance
|
||||
@@ -473,9 +444,13 @@ static void dictionary_m_word_hidden(VM *vm) {
|
||||
void register_dictionary_manipulation_words(VM *vm) {
|
||||
|
||||
/* Register all dictionary manipulation words */
|
||||
register_word(vm, "[", dictionary_m_word_left_bracket);
|
||||
register_word(vm, "]", dictionary_m_word_right_bracket);
|
||||
register_word(vm, "STATE", dictionary_m_word_state);
|
||||
/* [, ], STATE are NOT registered here: defining_words.c registers the
|
||||
* same three names later in boot order (word_registry.c Module 17 vs
|
||||
* this file's Module 13), and FORTH's newest-first dictionary lookup
|
||||
* means defining_words.c's versions are the only ones ever reachable.
|
||||
* The versions formerly here also wrote a dead file-scope static
|
||||
* instead of vm->state_addr -- see proof/StarForth_Defining_Words.thy
|
||||
* and proof/FINDINGS.md §1. */
|
||||
register_word(vm, "SMUDGE", dictionary_m_word_smudge);
|
||||
register_word(vm, "HIDDEN", dictionary_m_word_hidden);
|
||||
register_word(vm, ">BODY", dictionary_m_word_to_body);
|
||||
|
||||
Reference in New Issue
Block a user