[Mesa-dev] [PATCH v2 05/32] glsl: Zero per_vertex_accumulator::fields for valgrind & nir_serialize

Kenneth Graunke kenneth at whitecape.org
Thu Oct 19 23:51:04 UTC 2017


On Wednesday, October 18, 2017 10:31:53 PM PDT Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/compiler/glsl/builtin_variables.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
> index ea2d897cc8..d3cf12475b 100644
> --- a/src/compiler/glsl/builtin_variables.cpp
> +++ b/src/compiler/glsl/builtin_variables.cpp
> @@ -318,6 +318,7 @@ per_vertex_accumulator::per_vertex_accumulator()
>     : fields(),
>       num_fields(0)
>  {
> +   memset(fields, 0, sizeof(fields));
>  }

This shouldn't fix anything, we're calling the fields() constructor,
which should value-initialize every element of the fields array,
calling the constructor for glsl_struct_type on each element.

That constructor is supposed to zero initialize items.  Maybe it is
missing some of them?

FWIW, I trying to figure out the behavior of this by reading the
rules here:

https://stackoverflow.com/questions/1628311/array-initialisation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171019/e7f1792a/attachment.sig>


More information about the mesa-dev mailing list