Skip to content

Fix ~30 more crashes across §5.1/§5.2 of the not-implemented audit - #304

Merged
ASDAlexander77 merged 2 commits into
mainfrom
fix-not-implemented-audit-pass-7-8
Jul 26, 2026
Merged

Fix ~30 more crashes across §5.1/§5.2 of the not-implemented audit#304
ASDAlexander77 merged 2 commits into
mainfrom
fix-not-implemented-audit-pass-7-8

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

Continues the ongoing llvm_unreachable("not implemented") crash audit (see docs/not-implemented-audit.md). This PR closes:

  • §5.1 — the last remaining named/specific markers (MLIRGenImpl.h's last 2 sites, MLIRGenInterfaces.cpp's remaining 2, all 10 of MLIRGenTypes.cpp, LLVMCodeHelper.h:452)
  • §5.2 — every generic TypeSwitch::Default/switch fallback this audit had inventoried, across 12 files (CastLogicHelper.h, MLIRGenClasses.cpp, MLIRGenExpressions.cpp, MLIRGenGenerics.cpp, MLIRGenImpl.h's remaining cluster, CodeLogicHelper.h, OptionalLogicHelper.h, UndefLogicHelper.h, MLIRCodeLogic.h, MLIRPrinter.h, MLIRTypeIterator.h, Win32ExceptionPass.cpp)

Real, confirmed crashes fixed

  • Widening number[] to an any[] parameter
  • class extends <interface> / class implements <type-alias> (naming the wrong kind of type in a heritage clause)
  • obj.accessor++/-- on a get/set accessor property (the oldest documented gap in the audit — its own // TODO: finish it for field access predates this whole effort)
  • foo<T>(): T called as foo() with nothing to infer T from
  • Array-destructuring from a string ([a, b] = "hi") and object rest-destructuring (({a, ...rest} = obj))
  • Spreading a custom iterator whose next() isn't a well-formed {value, done} shape
  • Non-string computed interface method names, Foo[string] indexed access, type-literal get/set accessors
  • A getNameWithArguments UB crash (return nullptr; constructing a std::string, found via WinDbg while chasing an unrelated repro)

Notable finds

  • Two heritage-clause/destructuring fixes each surfaced a second bug: the original code had no failure-tracking at all in its TypeSwitch loop, so the first attempt's emitError was silently swallowed until a success flag was added.
  • MLIRTypeIterator.h (this compiler's most widely-called recursive type-walker) was missing a NamespaceType case entirely — found by diffing against TypeScriptTypes.td's type list rather than reproducing a crash.
  • Two bugs were found but deliberately not fixed here (different category, noted in the doc for a future pass): an LLVM Casting.h assertion reachable via a computed class-property initializer, and a delete-expression crash that reproduced once and then never again.

Full per-site real/dead/unconfirmed breakdown is in docs/not-implemented-audit.md (§4.12-§4.13).

Test plan

  • ctest -C Debug -j8 → 829/829 passing, re-verified after every file's fixes throughout both passes (not just once at the end)
  • Each confirmed-crash repro re-run clean (no crash, clean diagnostic) after its fix

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits July 26, 2026 13:15
Closes the named/specific marker list (§5.1) and every generic
TypeSwitch::Default fallback this audit had inventoried (§5.2) across
16 files. Real, confirmed crashes fixed include: array widening to
any[], class/interface heritage clauses naming the wrong kind of type,
accessor ++/--, generic zero-arg type inference failure, destructuring
assignment gaps (array-from-string, object rest-spread), spreading a
malformed custom iterator, non-string computed interface method names,
Foo[string] indexed access, and a getNameWithArguments UB crash
(return nullptr as std::string). Also fixes a genuine missing
NamespaceType case in MLIRTypeIterator.h, found by diffing against
TypeScriptTypes.td's type list rather than a repro.

Full per-site real/dead/unconfirmed breakdown in
docs/not-implemented-audit.md (§4.12-§4.13). 829/829 tests passing,
verified after every file's fixes throughout both passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Both share one root cause: TupleFieldName() (MLIRGenTypes.cpp) returns a
null mlir::Attribute in two unguarded cases - a computed field name that
fails to extract a compile-time constant, and a BindingPattern name
falling through to an invalid name.as<Expression>() cast. Both manifest
as an unguarded dyn_cast/cast<StringAttr> crashing on the null result
downstream ("dyn_cast on a non-existent value").

Fixed with null-checks at 4 call sites in MLIRGenClasses.cpp (computed
class-field names, e.g. `class X { [key] = 42; }`) and a BindingPattern
guard directly in TupleFieldName itself (parameter properties combined
with destructuring, e.g. `constructor(public {x,y}: T)`), fixing the
root function once for every caller.

829/829 tests passing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit d301145 into main Jul 26, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-not-implemented-audit-pass-7-8 branch July 26, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant