[Mesa-dev] [PATCH] nir: don't emit empty initializers for MSVC
Connor Abbott
cwabbott0 at gmail.com
Thu May 2 19:35:30 UTC 2019
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 <brianp at vmware.com> 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
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190502/fb4187a9/attachment.html>
More information about the mesa-dev
mailing list