This will crash at runtime, since it'll construct a "struct transform" with
all NULL pointers, and then the loop below in ${pass_name}_block() will see
that there's one transform in the array since it uses ARRAY_SIZE and then
crash trying to access it.

Running piglit with i965, or radeonsi will reproduce the crash.

On Thu, May 2, 2019 at 7:52 PM Brian Paul <[email protected]> wrote:

> This fixes a build failure with MSVC.
>
> ---
>
> I've compiled tested this, but not sure how to runtime test it.
> ---
>  src/compiler/nir/nir_algebraic.py | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/compiler/nir/nir_algebraic.py
> b/src/compiler/nir/nir_algebraic.py
> index 6db749e..dc25421 100644
> --- a/src/compiler/nir/nir_algebraic.py
> +++ b/src/compiler/nir/nir_algebraic.py
> @@ -997,6 +997,9 @@ static const struct transform
> ${pass_name}_state${state_id}_xforms[] = {
>  % for i in state_xforms:
>    { ${xforms[i].search.c_ptr(cache)},
> ${xforms[i].replace.c_value_ptr(cache)}, ${xforms[i].condition_index} },
>  % endfor
> +% if state_xforms == []: # avoid empty initializers for MSVC
> +  0
> +% endif
>  };
>  % endfor
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to