Skip to content

Fix JIT compilation crash when casting to Bool - #96013

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-jit-cast-nullable-bool
Feb 6, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-jit-cast-nullable-bool

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 5, 2026 •

Copy link
Copy Markdown
Member

The nativeBoolCast function returns an LLVM i1 (1-bit) value, but Bool type in ClickHouse is UInt8 which maps to LLVM i8 (8-bit).

When casting to Nullable(Bool), the code attempted to insert the i1 result into a nullable struct {i8, i1} at index 0, which expected i8. This type mismatch caused an LLVM assertion failure and server crash.

The fix adds CreateZExt to extend the boolean i1 result to i8 before using it as a Bool value.

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix JIT compiled queries involving Bool types.

Version info

  • Merged into: 26.2.1.299

The `nativeBoolCast` function returns an LLVM `i1` (1-bit) value, but
`Bool` type in ClickHouse is `UInt8` which maps to LLVM `i8` (8-bit).

When casting to `Nullable(Bool)`, the code attempted to insert the `i1`
result into a nullable struct `{i8, i1}` at index 0, which expected `i8`.
This type mismatch caused an LLVM assertion failure and server crash.

The fix adds `CreateZExt` to extend the boolean `i1` result to `i8`
before using it as a `Bool` value.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [100a5cd]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_ubsan, sequential) failure
03032_dynamically_resize_filesystem_cache_2 FAIL cidb, issue
Stress test (arm_asan, s3) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb
Stress test (amd_ubsan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb
AST fuzzer (amd_tsan) failure
Logical error: Unexpected variable size of data for type A. Column size B. Element size C. Number of elements D (STID: 4126-63b5) FAIL cidb

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Feb 5, 2026
@alexey-milovidov
alexey-milovidov merged commit 5a10037 into master Feb 6, 2026
125 of 129 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-jit-cast-nullable-bool branch February 6, 2026 03:32
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 6, 2026
@davenger davenger added the post-approved Approved, but after the PR is merged. label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

post-approved Approved, but after the PR is merged. pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants