tree-sitter / tree-sitter/tree-sitter-cpp

bug: comparison of integer expressions of different signedness on aarch64

Open
#338 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
453
Forks
185
PR merge metrics
No merged PRs in 30d

Description

Did you check existing issues?
  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

0.23.4

Describe the bug

While building cvise which imported tree-sitter-cpp 0.23.4, we get the following error when building for openSUSE Tumbleweed aarch64:

[   29s] [ 15%] Building C object tree-sitter-cpp/CMakeFiles/tree-sitter-cpp.dir/src/scanner.c.o
[   29s] cd /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/build/tree-sitter-cpp && /usr/bin/cc -DHAVE_CONFIG_H -I/home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src -mbranch-protection=standard -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fuse-ld=mold -Wall -Wextra -Werror -Wno-unused-parameter -Wno-error=maybe-uninitialized -Wno-error=class-memaccess -Wno-error=non-template-friend -Wno-error=deprecated-declarations -O2 -g -DNDEBUG -std=gnu11 -fPIC -MD -MT tree-sitter-cpp/CMakeFiles/tree-sitter-cpp.dir/src/scanner.c.o -MF CMakeFiles/tree-sitter-cpp.dir/src/scanner.c.o.d -o CMakeFiles/tree-sitter-cpp.dir/src/scanner.c.o -c /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src/scanner.c
[   29s] /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src/scanner.c: In function ‘scan_raw_string_delimiter’:
[   29s] /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src/scanner.c:32:34: error: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘wchar_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
[   29s]    32 |             if (lexer->lookahead != scanner->delimiter[i]) {
[   29s]       |                                  ^~
[   29s] /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src/scanner.c: In function ‘scan_raw_string_content’:
[   29s] /home/abuild/rpmbuild/BUILD/cvise-2.12.0+git.20251010.334b9acf-build/cvise-2.12.0+git.20251010.334b9acf/tree-sitter-cpp/src/scanner.c:78:38: error: comparison of integer expressions of different signedness: ‘int32_t’ {aka ‘int’} and ‘wchar_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
[   29s]    78 |                 if (lexer->lookahead == scanner->delimiter[delimiter_index]) {
[   29s]       |                                      ^~
[   29s] cc1: all warnings being treated as errors
[   29s] make[2]: *** [tree-sitter-cpp/CMakeFiles/tree-sitter-cpp.dir/build.make:100: tree-sitter-cpp/CMakeFiles/tree-sitter-cpp.dir/src/scanner.c.o] Error 1
Steps To Reproduce/Bad Parse Tree

Build for aarch64 with -Werror=sign-compare

Expected Behavior/Parse Tree

It should build fine.

Repro
// Example code that causes the issue
void foo() {
  // Code that fails to parse, or causes an error
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/scanner.c, especially scan_raw_string_delimiter and scan_raw_string_content, where the reported signedness comparisons occur. Reproduce the build on aarch64 or with -Werror=sign-compare, then verify that tree-sitter-cpp builds successfully with those warnings treated as errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.