Skip to content

Fix OCaml compiler regressions - #6

Merged
miselin merged 1 commit into
mainfrom
codex/fix-ocaml-port-regressions
Jul 27, 2026
Merged

Fix OCaml compiler regressions#6
miselin merged 1 commit into
mainfrom
codex/fix-ocaml-port-regressions

Conversation

@miselin

@miselin miselin commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • restore true short-circuit evaluation and left associativity for multiplicative operators
  • allow composable pointer/type postfixes and mutation through casted pointer expressions
  • preserve initializer-less public globals as external declarations
  • emit correctly typed constant global initializers and keep startup-initialized data writable in LLVM
  • report duplicate function definitions before malformed LLVM reaches code generation
  • strengthen parser, LLVM IR, semantic, and runtime regression coverage

Why

I attempted a port of DOOM from C to Haven, and discovered several rough edges and pure compiler bugs along the way. Some of these were regressions from the OCaml branch, but some were carried over from the previous C implementation of the compiler.

This also revealed some limits in the test coverage. For example, the previous short-circuit test used division by zero as an unobservable RHS computation, which allowed eager evaluation to escape detection. That test has been updated to explicitly flush out incorrect short-circuit behavior and avoid regressing again.

Validation

  • dune runtest
  • dune build @all
  • runtime regression cases at -Os, -O0, -O1, -O2, and -O3
  • git diff --check

@miselin miselin changed the title Fix OCaml compiler regressions exposed by DOOM port Fix OCaml compiler regressions Jul 27, 2026
@miselin miselin added the ai-generated This PR/code was majority generated by AI and may require deeper review. label Jul 27, 2026
@miselin
miselin marked this pull request as ready for review July 27, 2026 17:05
@miselin
miselin merged commit c097b7a into main Jul 27, 2026
6 checks passed
@miselin
miselin deleted the codex/fix-ocaml-port-regressions branch July 27, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated This PR/code was majority generated by AI and may require deeper review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant