[Mesa-dev] [PATCH] gallivm: fix bogus assert in get_indirect_index

Brian Paul brianp at vmware.com
Mon Apr 15 22:07:31 UTC 2019


On 04/15/2019 01:39 PM, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
> 
> 0 is a valid value as max index, and the code handles it fine. This isn't
> commonly seen, as it will only happen with array declarations of size 1.
> The assert was introduced with a3c898dc97ec5f0e0b93b2ee180bdf8ca3bab14c.
> 
> Fixes piglit tests/shaders/complex-loop-analysis-bug.shader_test
> Bugzilla: https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D110441&data=02%7C01%7Cbrianp%40vmware.com%7Cc4b58aeaf4c245f7794e08d6c1da2226%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636909539954259111&sdata=l%2BScozK4SM92MrI4bIo7CBa1HujD0OFeKDz9ixvUdI8%3D&reserved=0
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 0f5b3d9acb7..d6af1d84471 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -1108,7 +1108,7 @@ get_indirect_index(struct lp_build_tgsi_soa_context *bld,
>       * larger than the declared size but smaller than the buffer size.
>       */
>      if (reg_file != TGSI_FILE_CONSTANT) {
> -      assert(index_limit > 0);
> +      assert(index_limit >= 0);
>         max_index = lp_build_const_int_vec(bld->bld_base.base.gallivm,
>                                            uint_bld->type, index_limit);
>   
> 

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list