From e13581b041fb0cd6571f7241229e8081d2b3e72b Mon Sep 17 00:00:00 2001 From: Aron Griffis Date: Tue, 22 Dec 2020 15:19:35 -0500 Subject: [PATCH] Fix build with GCC 11 It seems redundant to array_init() when the structure is zeroed already in the static assignment. But probably the fact that this code juggles between TSTreeCursor and TreeCursor, without using a union, leaves the compiler unable to tell that it's been initialized. Fixes https://github.com/tree-sitter/tree-sitter/issues/853 --- lib/src/tree_cursor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/src/tree_cursor.c b/lib/src/tree_cursor.c index 98b86605..4c6f1b82 100644 --- a/lib/src/tree_cursor.c +++ b/lib/src/tree_cursor.c @@ -448,6 +448,7 @@ TSTreeCursor ts_tree_cursor_copy(const TSTreeCursor *_cursor) { TSTreeCursor res = {NULL, NULL, {0, 0}}; TreeCursor *copy = (TreeCursor *)&res; copy->tree = cursor->tree; + array_init(©->stack); array_push_all(©->stack, &cursor->stack); return res; }