[Mesa-dev] [PATCH RESEND] spirv: Silence compiler warning about undefined srcs[0]

Ian Romanick idr at freedesktop.org
Mon Mar 12 18:45:36 UTC 2018


Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 03/12/2018 11:21 AM, Eric Anholt wrote:
> v2: Use assume() at the srcs[] definition instead.
> 
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> Cc: Ian Romanick <idr at freedesktop.org>
> Cc: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
>  src/compiler/spirv/spirv_to_nir.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
> index 6a358c597316..3de45c47371e 100644
> --- a/src/compiler/spirv/spirv_to_nir.c
> +++ b/src/compiler/spirv/spirv_to_nir.c
> @@ -2925,6 +2925,7 @@ vtn_handle_composite(struct vtn_builder *b, SpvOp opcode,
>  
>     case SpvOpCompositeConstruct: {
>        unsigned elems = count - 3;
> +      assume(elems >= 1);
>        if (glsl_type_is_vector_or_scalar(type)) {
>           nir_ssa_def *srcs[4];
>           for (unsigned i = 0; i < elems; i++)
> 



More information about the mesa-dev mailing list