aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/compiler/brw_eu_validate.c
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2019-09-25 11:17:11 +0200
committerMichel Dänzer <[email protected]>2019-10-24 16:16:49 +0200
commit59b72bdfb433aedc379c622438e52bdb482d3c66 (patch)
tree1e908c753d8e423ab4abdacbb57f388801d60f09 /src/intel/compiler/brw_eu_validate.c
parent47571a01ecdce093dacde52a22f156759df3ebf8 (diff)
intel/compiler: Don't left-shift by >= the number of bits of the type
To avoid it, use the modulo of the number of bits in the value being shifted, which is presumably what ended up happening on x86. Flagged by UBSan: ../src/intel/compiler/brw_eu_validate.c:974:33: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int' #0 0x561abb612ab3 in general_restrictions_on_region_parameters ../src/intel/compiler/brw_eu_validate.c:974 #1 0x561abb617574 in brw_validate_instructions ../src/intel/compiler/brw_eu_validate.c:1851 #2 0x561abb53bd31 in validate ../src/intel/compiler/test_eu_validate.cpp:106 #3 0x561abb555369 in validation_test_source_cannot_span_more_than_2_registers_Test::TestBody() ../src/intel/compiler/test_eu_validate.cpp:486 #4 0x561abb742651 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #5 0x561abb72e64d in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #6 0x561abb6d5451 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #7 0x561abb6d7b2a in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #8 0x561abb6da2b8 in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #9 0x561abb6f5c92 in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #10 0x561abb74626a in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #11 0x561abb732025 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #12 0x561abb6ed2b4 in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #13 0x561abb768b3b in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #14 0x561abb7689fb in main ../src/gtest/src/gtest_main.cc:37 #15 0x7f525e5a9bba in __libc_start_main ../csu/libc-start.c:308 #16 0x561abb538ed9 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/intel/compiler/eu_validate+0x1b8ed9) Reviewed-by: Adam Jackson <[email protected]>
Diffstat (limited to 'src/intel/compiler/brw_eu_validate.c')
-rw-r--r--src/intel/compiler/brw_eu_validate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/intel/compiler/brw_eu_validate.c b/src/intel/compiler/brw_eu_validate.c
index 9e9033910b1..5953c82bc70 100644
--- a/src/intel/compiler/brw_eu_validate.c
+++ b/src/intel/compiler/brw_eu_validate.c
@@ -980,7 +980,7 @@ general_restrictions_on_region_parameters(const struct gen_device_info *devinfo,
unsigned offset = rowbase;
for (int x = 0; x < width; x++) {
- access_mask |= mask << offset;
+ access_mask |= mask << (offset % 64);
offset += hstride * element_size;
}
@@ -1250,7 +1250,7 @@ align1_access_mask(uint64_t access_mask[static 32],
unsigned offset = rowbase;
for (int x = 0; x < width; x++) {
- access_mask[element++] = mask << offset;
+ access_mask[element++] = mask << (offset % 64);
offset += hstride * element_size;
}