[Mesa-dev] [PATCH 4/4] main: avoid 'may be used uninitialized' warnings
asimiklit.work at gmail.com
asimiklit.work at gmail.com
Tue Sep 11 12:42:07 UTC 2018
From: Andrii Simiklit <andrii.simiklit at globallogic.com>
1. main/texcompress_etc.c:1314:12:
warning: ‘*((void *)&dst+2)’ may be used uninitialized in this function
2. main/texcompress_etc.c:1354:12:
warning: ‘*((void *)&dst+2)’ may be used uninitialized in this function
3. main/texcompress_etc.c:1293:12:
warning: ‘dst’ may be used uninitialized in this function
4. main/texcompress_etc.c:1335:12:
warning: ‘dst’ may be used uninitialized in this function
5. main/texcompress_etc.c:1460:12:
warning: ‘*((void *)&dst+1)’ may be used uninitialized in this function
6. main/texcompress_s3tc_tmp.h:262:39:
warning: ‘pixerrorcolorbest[2]’ may be used uninitialized in this function
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
---
src/mesa/main/texcompress_etc.c | 12 ++++++------
src/mesa/main/texcompress_s3tc_tmp.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index b39ab33..b192708 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -1290,7 +1290,7 @@ fetch_etc2_rgb8(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[3];
+ uint8_t dst[3] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
@@ -1311,7 +1311,7 @@ fetch_etc2_srgb8(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[3];
+ uint8_t dst[3] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
@@ -1332,7 +1332,7 @@ fetch_etc2_rgba8_eac(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[4];
+ uint8_t dst[4] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 16;
@@ -1351,7 +1351,7 @@ fetch_etc2_srgb8_alpha8_eac(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[4];
+ uint8_t dst[4] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 16;
@@ -1457,7 +1457,7 @@ fetch_etc2_rgb8_punchthrough_alpha1(const GLubyte *map,
GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[4];
+ uint8_t dst[4] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
@@ -1478,7 +1478,7 @@ fetch_etc2_srgb8_punchthrough_alpha1(const GLubyte *map,
GLint i, GLint j, GLfloat *texel)
{
struct etc2_block block;
- uint8_t dst[4];
+ uint8_t dst[4] = { 0 };
const uint8_t *src;
src = map + (((rowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
diff --git a/src/mesa/main/texcompress_s3tc_tmp.h b/src/mesa/main/texcompress_s3tc_tmp.h
index 92316a7..bb1e37c 100644
--- a/src/mesa/main/texcompress_s3tc_tmp.h
+++ b/src/mesa/main/texcompress_s3tc_tmp.h
@@ -194,7 +194,7 @@ static void fancybasecolorsearch( UNUSED GLubyte *blkaddr, GLubyte srccolors[4][
GLuint pixerror, pixerrorred, pixerrorgreen, pixerrorblue, pixerrorbest;
GLint colordist, blockerrlin[2][3];
GLubyte nrcolor[2];
- GLint pixerrorcolorbest[3];
+ GLint pixerrorcolorbest[3] = { 0 };
GLubyte enc = 0;
GLubyte cv[4][4];
GLubyte testcolor[2][3];
--
2.7.4
More information about the mesa-dev
mailing list