Mesa (main): nvc0: Fix uninitialized width/height/depth warning.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 4 16:40:35 UTC 2021


Module: Mesa
Branch: main
Commit: 7d64f0dd1612a4ea645a83f507fa7612cb27aefa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d64f0dd1612a4ea645a83f507fa7612cb27aefa

Author: Joshua Ashton <joshua at froggi.es>
Date:   Tue Sep 21 11:10:05 2021 +0100

nvc0: Fix uninitialized width/height/depth warning.

This can happen if view->resource is false.

Fixes a warning in GCC 9+ that's been bugging me for a very long time when building Mesa.

Signed-off-by: Joshua Ashton <joshua at froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12955>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
index a9b475e7e36..f7c3d5f1b9d 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
@@ -1136,7 +1136,7 @@ nvc0_validate_suf(struct nvc0_context *nvc0, int s)
 
    for (int i = 0; i < NVC0_MAX_IMAGES; ++i) {
       struct pipe_image_view *view = &nvc0->images[s][i];
-      int width, height, depth;
+      int width = 0, height = 0, depth = 0;
       uint64_t address = 0;
 
       if (s == 5)



More information about the mesa-commit mailing list