Skip to content

Commit 8b5492a

Browse files
1acedcbaker-intel
authored andcommitted
panfrost: upcast uint8/uint16 before shifting them beyond their range
../src/panfrost/compiler/compiler.h:89:14: runtime error: left shift of 51966 by 16 places cannot be represented in type 'int' #0 0x55c72fd7dda4 in bi_apply_swizzle ../src/panfrost/compiler/compiler.h:89 android-rpi#1 0x55c72fd808d6 in bi_source_value ../src/panfrost/compiler/bi_opt_constant_fold.c:35 android-rpi#2 0x55c72fd80a83 in bi_fold_constant ../src/panfrost/compiler/bi_opt_constant_fold.c:52 android-rpi#3 0x55c72fb2080c in constant_fold_pred ../src/panfrost/compiler/test/test-constant-fold.cpp:48 #4 0x55c72fb21a65 in ConstantFold_Swizzles_Test::TestBody() ../src/panfrost/compiler/test/test-constant-fold.cpp:103 #5 0x55c73070cc97 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2621 #6 0x55c7306f0df7 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2657 #7 0x55c730694add in testing::Test::Run() ../src/gtest/src/gtest.cc:2696 #8 0x55c73069798d in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2845 #9 0x55c73069b684 in testing::TestSuite::Run() ../src/gtest/src/gtest.cc:3004 #10 0x55c7306ccfcb in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:5890 #11 0x55c73071053c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2621 #12 0x55c7306f4ed3 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2657 #13 0x55c7306c23fa in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:5455 #14 0x55c730748faf in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2314 #15 0x55c730748ffa in main ../src/gtest/src/gtest_main.cc:63 #16 0x7f8554bcc1c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 #17 0x7f8554bcc284 in __libc_start_main_impl ../csu/libc-start.c:360 #18 0x55c72fb18be0 in _start (/builds/mesa/mesa/_build/src/panfrost/compiler/bifrost_tests+0xbd0be0) Cc: mesa-stable Signed-off-by: Eric Engestrom <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24610> (cherry picked from commit 54c7099)
1 parent 5e903ee commit 8b5492a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8254,7 +8254,7 @@
82548254
"description": "panfrost: upcast uint8/uint16 before shifting them beyond their range",
82558255
"nominated": true,
82568256
"nomination_type": 0,
8257-
"resolution": 0,
8257+
"resolution": 1,
82588258
"main_sha": null,
82598259
"because_sha": null,
82608260
"notes": null

src/panfrost/compiler/compiler.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ bi_apply_swizzle(uint32_t value, enum bi_swizzle swz)
7979
const uint16_t *h = (const uint16_t *)&value;
8080
const uint8_t *b = (const uint8_t *)&value;
8181

82-
#define H(h0, h1) (h[h0] | (h[h1] << 16))
83-
#define B(b0, b1, b2, b3) (b[b0] | (b[b1] << 8) | (b[b2] << 16) | (b[b3] << 24))
82+
#define H(h0, h1) (h[h0] | ((uint32_t)h[h1] << 16))
83+
#define B(b0, b1, b2, b3) \
84+
(b[b0] | ((uint32_t)b[b1] << 8) | ((uint32_t)b[b2] << 16) | \
85+
((uint32_t)b[b3] << 24))
8486

8587
switch (swz) {
8688
case BI_SWIZZLE_H00:

0 commit comments

Comments
 (0)