code-yeongyu / code-yeongyu/c11-compiler-zig-omo
[Sisyphus] phase-3 / verify / Wave E — -O0 vs -O2 differential
- Dominant language
- C
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Scope
Verify that `-O0` and `-O2` builds of the same source produce identical observable behavior while differing in IR and ASM size.
## Deliverables
- `phase3/scripts/opt-differential.sh` — script that:
1. Compiles every `phase1/c11-ref/*.c` with `zcc -O0` and `zcc -O2`.
2. Runs both binaries and captures stdout, stderr, exit code.
3. Compares outputs; any mismatch is flagged as a bug.
4. Verifies IR size and ASM size differ (sanity check that optimization actually ran).
## Success Criteria
1. For every `phase1/c11-ref/*.c`, `-O0` and `-O2` binaries produce identical stdout, stderr, and exit code.
2. IR size at `-O2` is strictly smaller than at `-O0` for all non-trivial files.
3. ASM size at `-O2` is smaller or equal to `-O0`.
4. Any mismatch is reported with source file, diff of outputs, and IR/ASM sizes.
## Dependencies
- Phase 2 Wave 6 (optimization passes) must be complete.
- Phase 2 Wave 10 (driver) must be complete.
## Suggested Role Assignment
`opt-differential-engineer`
## Test Corpus Expectations
- All `phase1/c11-ref/*.c` compiled and compared at both levels.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Phase 2 optimization passes and driver, then inspect the phase1/c11-ref/*.c corpus and the zcc invocation used there. Implement phase3/scripts/opt-differential.sh to build and run every source at -O0 and -O2, compare outputs and exit codes, and record IR and ASM sizes. Done means mismatches identify the source and output diff, and all stated size checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, shell
- Domain
- compilers, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100