Module: Mesa Branch: main Commit: ff34e96701ef8f6e52755685a5ef9425c0229cfd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff34e96701ef8f6e52755685a5ef9425c0229cfd
Author: Lionel Landwerlin <[email protected]> Date: Tue Jan 17 23:42:03 2023 +0200 nir/lower_io: fix bounds checking for 64bit_bounded_global If the offset is negative like it's the case in dEQP-VK.robustness.robustness2.bind.notemplate.r32i.unroll.volatile.storage_buffer_dynamic.readwrite.no_fmt_qual.len_256.samples_1.1d.comp we end up passing the bounds checking condition because it's using signed integers. Signed-off-by: Lionel Landwerlin <[email protected]> Suggested-by: Jason Ekstrand <[email protected]> Cc: mesa-stable Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Reviewed-by: Emma Anholt <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20762> --- src/compiler/nir/nir_lower_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 1ace5f597b7..9fc4e5bed0f 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1184,8 +1184,9 @@ addr_is_in_bounds(nir_builder *b, nir_ssa_def *addr, { assert(addr_format == nir_address_format_64bit_bounded_global); assert(addr->num_components == 4); - return nir_ige(b, nir_channel(b, addr, 2), - nir_iadd_imm(b, nir_channel(b, addr, 3), size)); + assert(size > 0); + return nir_ult(b, nir_iadd_imm(b, nir_channel(b, addr, 3), size - 1), + nir_channel(b, addr, 2)); } static void
