From 1c1855cc0040b63deaf9ae1caf5d32d55476686e Mon Sep 17 00:00:00 2001 From: David Heidelberg Date: Wed, 3 May 2023 23:30:27 +0200 Subject: [PATCH] nir/lower_io_to_vector: initialize base Prevent GCC warning: ``` [230/1401] Compiling C object src/compiler/nir/libnir.a.p/nir_lower_io_to_vector.c.o In function 'get_flat_type', inlined from 'create_new_io_vars' at ../src/compiler/nir/nir_lower_io_to_vector.c:300:10: ../src/compiler/nir/nir_lower_io_to_vector.c:208:14: warning: 'base' may be used uninitialized [-Wmaybe-uninitialized] 208 | return glsl_array_type(glsl_vector_type(base, 4), slots, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/compiler/nir/nir_lower_io_to_vector.c: In function 'create_new_io_vars': ../src/compiler/nir/nir_lower_io_to_vector.c:163:24: note: 'base' was declared here 163 | enum glsl_base_type base; | ^~~~ ``` Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8957 Reviewed-by: Faith Ekstrand Reviewed-by: Mike Blumenkrantz Signed-off-by: David Heidelberg Part-of: --- src/compiler/nir/nir_lower_io_to_vector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_io_to_vector.c b/src/compiler/nir/nir_lower_io_to_vector.c index c20d5b4d3cb..879381e109a 100644 --- a/src/compiler/nir/nir_lower_io_to_vector.c +++ b/src/compiler/nir/nir_lower_io_to_vector.c @@ -160,7 +160,7 @@ get_flat_type(const nir_shader *shader, nir_variable *old_vars[MAX_SLOTS][4], unsigned todo = 1; unsigned slots = 0; unsigned num_vars = 0; - enum glsl_base_type base; + enum glsl_base_type base = GLSL_TYPE_ERROR; *num_vertices = 0; *first_var = NULL;