Problem
After fixing optimizer regression in #183, emulator testing reveals bsearch still fails with a different root cause. Program execution stops immediately after the bsearch() call.
Reproduction
Test code:
#include <stdlib.h>
volatile unsigned char *test = (unsigned char *)0x4000;
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int main() {
test[0] = 0x11; // ✓ WRITES CORRECTLY
int arr[] = {10, 20, 30, 40, 50};
void *found = bsearch(&arr[2], arr, 5, sizeof(int), cmp);
test[1] = found ? 0xAA : 0xFF; // ✗ NEVER EXECUTES
test[2] = 0xFE; // ✗ NEVER EXECUTES
return 0;
}
Emulator result: 11 00 00 at $4000 (only first write executed, program stops)
Analysis
- Optimizer return-value-load regression is FIXED (verified in binary)
- Direct memory writes work correctly
- bsearch call appears to crash/hang or not return properly
- Suggests calling convention mismatch or inter-TU linking corruption
Related Issues
Labels
bugfix, v1.0.5, calling-convention, inter-TU-linking
Problem
After fixing optimizer regression in #183, emulator testing reveals bsearch still fails with a different root cause. Program execution stops immediately after the bsearch() call.
Reproduction
Test code:
Emulator result:
11 00 00at $4000 (only first write executed, program stops)Analysis
Related Issues
Labels
bugfix, v1.0.5, calling-convention, inter-TU-linking