Mesa (main): aco: fix right shift of exponent 32 detected by UBSAN
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 25 17:11:53 UTC 2021
Module: Mesa
Branch: main
Commit: add883bf9b2b692035428f6163073af82bc46f36
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=add883bf9b2b692035428f6163073af82bc46f36
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Thu Nov 25 07:36:10 2021 +0100
aco: fix right shift of exponent 32 detected by UBSAN
src/amd/compiler/aco_optimizer.cpp:1316:17: runtime error: shift
exponent 32 is too large for 32-bit type 'unsigned int'
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13951>
---
src/amd/compiler/aco_optimizer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 8d88d08e2d7..29ca5105691 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -1309,7 +1309,7 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
ssa_info& info = ctx.info[instr->operands[0].tempId()];
if (info.is_constant_or_literal(32)) {
- uint32_t val = info.val;
+ uint64_t val = info.val;
for (Definition def : instr->definitions) {
uint32_t mask = u_bit_consecutive(0, def.bytes() * 8u);
ctx.info[def.tempId()].set_constant(ctx.program->chip_class, val & mask);
More information about the mesa-commit
mailing list