Skip to content

Commit 4e8eed1

Browse files
committed
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 <wargloom@gmail.com>
1 parent 5e7d3eb commit 4e8eed1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/cbm/grammar_haskell.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// Vendored tree-sitter grammar: haskell
22
// Each grammar compiled as separate unit (conflicting static symbols).
3+
#include "vendored/common/tree_sitter/array.h" // strict-aliasing-safe helpers (tree-sitter#5242)
4+
typedef void *(*cbm_haskell_array_grow_fn)(void *, uint32_t, uint32_t *, uint32_t, size_t);
5+
_Static_assert(_Generic(&_array__grow, cbm_haskell_array_grow_fn: 1, default: 0),
6+
"Haskell scanner requires strict-aliasing-safe array helpers");
37
#include "vendored/grammars/haskell/parser.c"
48
#include "vendored/grammars/haskell/scanner.c"

0 commit comments

Comments
 (0)