[Mesa-dev] [PATCH v2 4/5] main: avoid 'may be used uninitialized' warnings
Eric Engestrom
eric.engestrom at intel.com
Tue Nov 13 16:41:28 UTC 2018
On Tuesday, 2018-11-13 14:19:31 +0200, asimiklit.work at gmail.com wrote:
> 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
>
> v2: Fixed by adding the unreachable case to the etc2_rgb8_fetch_texel
> ( Eric Engestrom <eric.engestrom at intel.com> )
> Changes for warning 'pixerrorcolorbest' were removed.
>
> Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>
This is the right way of fixing this code-wise, but I'm not 100% sure we
can actually guarantee this logic-wise, so I'll let someone else review
(and push) this patch.
Acked-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
> src/mesa/main/texcompress_etc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
> index b39ab33d36..f1da4d0f11 100644
> --- a/src/mesa/main/texcompress_etc.c
> +++ b/src/mesa/main/texcompress_etc.c
> @@ -548,6 +548,7 @@ etc2_rgb8_fetch_texel(const struct etc2_block *block,
> if (punchthrough_alpha)
> dst[3] = 255;
> }
> + else unreachable("unhandled block mode");
> }
>
> static void
> --
> 2.17.1
>
More information about the mesa-dev
mailing list