Mesa (master): radv/ac: some fix maybe-uninitialized warnings

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Sat Dec 10 21:02:34 UTC 2016


Module: Mesa
Branch: master
Commit: 90c29784c66577f33ca5c8139e33ad027a212125
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90c29784c66577f33ca5c8139e33ad027a212125

Author: Grazvydas Ignotas <notasas at gmail.com>
Date:   Sat Dec 10 21:10:05 2016 +0200

radv/ac: some fix maybe-uninitialized warnings

Mark some paths unreachable so that compiler knows variables are
initialized in all valid paths.

Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/common/ac_nir_to_llvm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d5dfbb1..398db6a 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -721,7 +721,8 @@ build_gather_values_extended(struct nir_to_llvm_context *ctx,
 		if (load)
 			return LLVMBuildLoad(builder, values[0], "");
 		return values[0];
-	}
+	} else if (!value_count)
+		unreachable("value_count is 0");
 
 	for (i = 0; i < value_count; i++) {
 		LLVMValueRef value = values[i * value_stride];
@@ -3151,6 +3152,8 @@ static LLVMValueRef get_sampler_desc(struct nir_to_llvm_context *ctx,
 		type = ctx->v4i32;
 		type_size = 16;
 		break;
+	default:
+		unreachable("invalid desc_type\n");
 	}
 
 	if (deref->deref.child) {




More information about the mesa-commit mailing list