freedreno: Suppress uninit var warnings from shader stage switch.
authorEric Anholt <eric@anholt.net>
Tue, 17 Nov 2020 21:43:28 +0000 (13:43 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 18 Nov 2020 18:15:02 +0000 (18:15 +0000)
It seems we have enough branches that the compiler gets confused now, and
I can also suppress the warning by replacing "unreachable()" with
"return".  Unreachable is good for debugging, so just 0-init the values.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7664>

src/gallium/drivers/freedreno/a6xx/fd6_program.c

index 64690c9..c32ec9d 100644 (file)
@@ -46,8 +46,8 @@ fd6_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
 {
        enum a6xx_state_block sb = fd6_stage2shadersb(so->type);
 
-       uint32_t obj_start;
-       uint32_t instrlen;
+       uint32_t obj_start = 0;
+       uint32_t instrlen = 0;
 
        switch (so->type) {
        case MESA_SHADER_VERTEX: