lima/gpir: fix warning in gpir disassembler
authorVasily Khoruzhick <anarsoul@gmail.com>
Sun, 1 Sep 2019 21:38:08 +0000 (14:38 -0700)
committerVasily Khoruzhick <anarsoul@gmail.com>
Mon, 9 Sep 2019 17:25:30 +0000 (10:25 -0700)
Fixes following warning:

../src/gallium/drivers/lima/ir/gp/disasm.c: In function ‘print_src’:
../src/gallium/drivers/lima/ir/gp/disasm.c:241:20: warning: array subscript 28 is above array bounds of ‘char[5]’ [-Warray-bounds]
  241 |              "xyzw"[src - gpir_codegen_src_attrib_x]);

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
src/gallium/drivers/lima/ir/gp/disasm.c

index 41a04942ec9c7d3756e01c581cecd27bc20866af..6b5186fa633d5f6e8a33fbbcd2d0ac294e56f116 100644 (file)
@@ -238,7 +238,7 @@ print_src(gpir_codegen_src src, gp_unit unit, unsigned unit_src_num,
    case gpir_codegen_src_p1_attrib_w:
       printf("%c%d.%c", prev_instr->register0_attribute ? 'a' : '$',
              prev_instr->register0_addr,
-             "xyzw"[src - gpir_codegen_src_attrib_x]);
+             "xyzw"[src - gpir_codegen_src_p1_attrib_x]);
       break;
    }
 }