[Mesa-dev] [PATCH] mesa: ensure that variable is initialized

Dylan Baker dylan at pnwbakers.com
Mon Apr 2 22:36:01 UTC 2018


Otherwise this variable will only be set if there are spirv shaders
present, but it's used regardless, resulting in undefined behavior.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105820
CC: Alejandro PiƱeiro <apinheiro at igalia.com>
CC: Mark Janes <mark.a.janes at intel.com>
Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
---
 src/mesa/program/ir_to_mesa.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 49ef5ea52d8..60fb24bf664 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3126,7 +3126,7 @@ void
 _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
    unsigned int i;
-   bool spirv;
+   bool spirv = false;
 
    _mesa_clear_shader_program_data(ctx, prog);
 
-- 
2.16.3



More information about the mesa-dev mailing list