Skip to content

[C++] Decimal32 support introduced an UBSAN error #44276

Description

@kou

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

GH-43957 introduced the following UBSAN error:

https://github.com/apache/arrow/actions/runs/11114266653/job/30880385337#step:6:4315

[ RUN ] Decimal32Test.LeftShift
/arrow/cpp/src/arrow/util/decimal_test.cc:1727:33: runtime error: left shift of 123 by 30 places cannot be represented in type 'int32_t' (aka 'int')
#0 0x562b6abc3a04 in arrow::Decimal32Test_LeftShift_Test::TestBody()::$_0::operator()(int, unsigned int) const /arrow/cpp/src/arrow/util/decimal_test.cc:1727:33
#1 0x562b6abbe4a3 in arrow::Decimal32Test_LeftShift_Test::TestBody() /arrow/cpp/src/arrow/util/decimal_test.cc:1741:3
#2 0x7fc0d8b24e7e in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/usr/local/lib/libarrow_testing.so.1800+0x106de7e) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#3 0x7fc0d8b19935 in testing::Test::Run() (/usr/local/lib/libarrow_testing.so.1800+0x1062935) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#4 0x7fc0d8b19ab4 in testing::TestInfo::Run() (/usr/local/lib/libarrow_testing.so.1800+0x1062ab4) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#5 0x7fc0d8b1a068 in testing::TestSuite::Run() (/usr/local/lib/libarrow_testing.so.1800+0x1063068) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#6 0x7fc0d8b1a76e in testing::internal::UnitTestImpl::RunAllTests() (/usr/local/lib/libarrow_testing.so.1800+0x106376e) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#7 0x7fc0d8b25446 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/usr/local/lib/libarrow_testing.so.1800+0x106e446) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#8 0x7fc0d8b19b7b in testing::UnitTest::Run() (/usr/local/lib/libarrow_testing.so.1800+0x1062b7b) (BuildId: 118793bf888d7168cdf3c1fc75787526ccb324c5)
#9 0x562b6b6576ed in RUN_ALL_TESTS() /usr/include/gtest/gtest.h:2490:46
#10 0x562b6b657639 in main /arrow/cpp/src/arrow/util/logging_test.cc:129:10
#0 0x7fc0b6b43d8f in
#12 0x7fc0b6b43e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f) (BuildId: 490fef8403240c91833978d494d39e537409b92e)
#13 0x562b6a697dc4 in _start (/build/cpp/debug/arrow-utility-test+0x13fddc4) (BuildId: aaabec8f2b98a2f0267cb51501c0340b2eec22e2)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /arrow/cpp/src/arrow/util/decimal_test.cc:1727:33 in
/build/cpp/src/arrow/util

Component(s)

C++

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions