freedreno/a2xx: Squash a compiler warning
authorKristian H. Kristensen <hoegsberg@chromium.org>
Tue, 16 Oct 2018 21:50:58 +0000 (14:50 -0700)
committerRob Clark <robdclark@gmail.com>
Fri, 26 Oct 2018 22:10:00 +0000 (18:10 -0400)
We get a warning here for assigning a const char * pointer to
char *swizzle in struct ir2_src_register.  The constructor strdups a 4
byte string here, so just memcpy to that instead.

Signed-off-by: Kristian H. Kristensen <hoegsberg@chromium.org>
src/gallium/drivers/freedreno/a2xx/fd2_compiler.c

index 7d33aa07a99d95f5882cfbc16a779064429282ea..156bfc247c2bdca0cfbba77e89bdc2b09f3262ff 100644 (file)
@@ -724,8 +724,8 @@ translate_tex(struct fd2_compile_context *ctx,
 
                instr = ir2_instr_create_alu_s(ctx->so->ir, RECIP_IEEE);
                add_dst_reg(ctx, instr, &tmp_dst)->swizzle = "x___";
-               add_src_reg(ctx, instr, &inst->Src[0].Register)->swizzle =
-                               swiz[inst->Src[0].Register.SwizzleW];
+               memcpy(add_src_reg(ctx, instr, &inst->Src[0].Register)->swizzle,
+                          swiz[inst->Src[0].Register.SwizzleW], 4);
 
                instr = ir2_instr_create_alu_v(ctx->so->ir, MULv);
                add_dst_reg(ctx, instr, &tmp_dst)->swizzle = "xyz_";