From 4e8eed19f931acc28df8ffd6667e272cf9bf88dd Mon Sep 17 00:00:00 2001 From: wargloom Date: Thu, 23 Jul 2026 18:40:13 +0300 Subject: [PATCH] fix(parser): use alias-safe Haskell arrays Preload the shared Tree-sitter array helpers before the pinned Haskell scanner so optimized builds do not retain a stale contents pointer across realloc. Keep a compile-time signature guard to prevent regression. Fixes #1231 Signed-off-by: wargloom --- internal/cbm/grammar_haskell.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/cbm/grammar_haskell.c b/internal/cbm/grammar_haskell.c index 58b70b7bf..61f67956a 100644 --- a/internal/cbm/grammar_haskell.c +++ b/internal/cbm/grammar_haskell.c @@ -1,4 +1,8 @@ // Vendored tree-sitter grammar: haskell // Each grammar compiled as separate unit (conflicting static symbols). +#include "vendored/common/tree_sitter/array.h" // strict-aliasing-safe helpers (tree-sitter#5242) +typedef void *(*cbm_haskell_array_grow_fn)(void *, uint32_t, uint32_t *, uint32_t, size_t); +_Static_assert(_Generic(&_array__grow, cbm_haskell_array_grow_fn: 1, default: 0), + "Haskell scanner requires strict-aliasing-safe array helpers"); #include "vendored/grammars/haskell/parser.c" #include "vendored/grammars/haskell/scanner.c"