Skip to content

Conversation

@WillLillis
Copy link
Member

I'm fairly certain taking the address of a non-lvalue is undefined behavior. The current Array definition allows for this to work somehow, but this patch works both with current tree-sitter as well as with the changes from tree-sitter/tree-sitter#5242.

Ran into this while working on tree-sitter/tree-sitter#5242

After this, would it be possible for a new release? tree-sitter-php is used for the core repo's corpus tests, and I believe this bug is causing CI to fail for tree-sitter/tree-sitter#5242.

@clason
Copy link

clason commented Jan 18, 2026

@WillLillis The node bindings are broken (tree-sitter npm package is stuck at 0.25.0); just disable the node tests until that is fixed.

@WillLillis WillLillis marked this pull request as draft January 19, 2026 04:05
@WillLillis WillLillis marked this pull request as ready for review January 19, 2026 04:48
# with:
# generate: false
# test-rust: true
# test-node: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's throwing the baby out with the bathwater ;)

It should be enough to set test-node: false here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(But you probably want to set generate: true to guard against a forgotten tree-sitter generate.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I purposely set generate: false because there was some bugs in the ci module---not sure if they've been fixed yet

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which module? I am not aware of any bug regarding generate (which is used in nearly all parser repos I am familiar with).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it had to do with the two grammars which the parser-test-action did not support

Additionally, it only generates the grammar for the tests, not the PR so I would rather ci fail because you didn't regenerate as opposed to the ci passing and then being merged without generation

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(You may be thinking of the regenerate workflow, which is a separate thing?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then try it and see---it used to not support parallel parsers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tree-sitter generate will replace the array.h headers that this PR has included in its second commit with the headers as they were committed in 0.26.3. When the new array_delete macro is replaced with the old one, we then get the same crash observed in CI runs for tree-sitter/tree-sitter#5242. I think this is likely due to the issues outlined in tree-sitter/tree-sitter#4960, the crash is definitely "weird"/ smells of an overly aggressive optimization. (If I add a printf in for any member of word before array_delete, everything works perfectly).

Given this, I'm not sure if this should land until after tree-sitter/tree-sitter#5242 is included in a tagged release for tree-sitter-cli. While it's a bit more work, I suspect we can do something to work around this problem for the purposes of our corpus tests in the core repo. Thoughts @clason?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also temporarily omit this parser from the fixture list to unblock this; this issue sounds serious enough for a timely bugfix release.

@clason
Copy link

clason commented Jan 24, 2026

looks like the go workflow uses an outdated Go toolchain? Maybe disable those tests for now, too.

Maybe disable those, too. (ceterum censeo these proliferating bindings are a moving target and need to be reined in...)

@WillLillis
Copy link
Member Author

Marking this as a draft until the Array impl changes are in tree-sitter-cli release. I'm not able to easily get tests parsing correctly with 0.26.3 (likely due to the strict aliasing violatings the Array changes fix).

@WillLillis WillLillis marked this pull request as draft January 24, 2026 19:16
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.

3 participants