[Piglit] [PATCH] tex-miplevel-selection: Fix GCC maybe-uninitialized warnings.

Vinson Lee vlee at freedesktop.org
Thu Jan 8 12:49:29 PST 2015


tex-miplevel-selection.c: In function 'piglit_init':
tex-miplevel-selection.c:919:58: warning: 'num_layers' may be used uninitialized in this function [-Wmaybe-uninitialized]
        (gltarget != GL_TEXTURE_3D && layer == TEST_LAYER % num_layers)) {
                                                          ^
tex-miplevel-selection.c:486:8: warning: 'type_str' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (!strcmp(type_str, "float"))
        ^
tex-miplevel-selection.c:764:4: warning: 'target_str' may be used uninitialized in this function [-Wmaybe-uninitialized]
    sprintf(fscode, GL3_FS_CODE, version, target_str,
    ^

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/texturing/tex-miplevel-selection.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/tex-miplevel-selection.c b/tests/texturing/tex-miplevel-selection.c
index 3c14735..54592f9 100644
--- a/tests/texturing/tex-miplevel-selection.c
+++ b/tests/texturing/tex-miplevel-selection.c
@@ -207,7 +207,7 @@ piglit_init(int argc, char **argv)
 	GLuint tex, fb, prog;
 	GLenum status;
 	int i, level, layer, dim, num_layers;
-	const char *target_str, *type_str, *compare_value_mask = "";
+	const char *target_str = "", *type_str = "", *compare_value_mask = "";
 	const char *offset_type_str = "", *declaration = "", *instruction;
 	const char *version = "130", *other_params = "", *deriv_type = "";
 	GLenum format, attachment, clearbits;
@@ -859,6 +859,7 @@ piglit_init(int argc, char **argv)
 		break;
 	default:
 		assert(0);
+		num_layers = 0;
 	}
 	if (!piglit_check_gl_error(GL_NO_ERROR))
 		piglit_report_result(PIGLIT_FAIL);
-- 
2.2.0



More information about the Piglit mailing list