Skip to content

[C++][Gandiva] Gandiva crashes when casting a large batch from int32 to decimal with JIT optimization disabled #55277

Open

Description

@dmitry-chirkov-dremio

Describe the bug, including details regarding any error messages, version, and platform.

To reproduce:

  1. Create 524,288 int32 rows.
  2. Build a projector with one cast to decimal128(10, 0).
  3. Use gandiva::Configuration(false).
  4. Evaluate the batch.

This crashes with SIGSEGV on macOS ARM64 with LLVM 21.1.7. With optimization enabled, it passes. Evaluation should work with either setting.

DecimalIR::CallDecimalFunction creates two stack slots for the decimal result. These allocations are inside the record loop, so each row uses more stack. The stack is only released when the function returns. DecimalIR::AddLarge has the same allocation pattern.

Moving the allocations to the function entry block should fix the crash.

Environment:

  • Arrow commit: 14132604b3949ba1c25cc79fff2e1782b9efc413
  • macOS ARM64, Apple M3
  • LLVM 21.1.7
  • RelWithDebInfo build, SIMD disabled

AI tools helped with the investigation, fix, and tests.

Component(s)

C++, Gandiva

Activity

  1. changed the title [-]Gandiva crashes when casting a large batch from int32 to decimal with JIT optimization disabled[/-] [+][C++][Gandiva] Gandiva crashes when casting a large batch from int32 to decimal with JIT optimization disabled[/+] on Oct 27, 2026
  2. added 2 commits that reference this issue on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions