Skip to content

lots of -Warray-bounds= warnings in llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp #125540

Open
@firewave

Description

@firewave
In function ‘DecodeStatus decodeRegisterClass(llvm::MCInst&, uint64_t, const llvm::MCPhysReg (&)[N]) [with long unsigned int N = 32]’,
    inlined from ‘DecodeStatus decodeRegisterClass(llvm::MCInst&, uint64_t, const llvm::MCPhysReg (&)[N]) [with long unsigned int N = 8]’ at /home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp:84:21,
    inlined from ‘DecodeStatus DecodeCRRCRegisterClass(llvm::MCInst&, uint64_t, uint64_t, const llvm::MCDisassembler*)’ at /home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp:95:29,
    inlined from ‘DecodeStatus DecodeCRRCRegisterClass(llvm::MCInst&, uint64_t, uint64_t, const llvm::MCDisassembler*)’ at /home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp:92:21,
    inlined from ‘DecodeStatus llvm::decodeToMCInst(DecodeStatus, unsigned int, InsnType, MCInst&, uint64_t, const MCDisassembler*, bool&) [with InsnType = long unsigned int]’ at /home/user/CLionProjects/llvm-project/build/lib/Target/PowerPC/PPCGenDisassemblerTables.inc:6610:15:
/home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp:88:44: warning: array subscript ‘const llvm::MCPhysReg [32] {aka const short unsigned int [32]}[0]’ is partly outside array bounds of ‘const llvm::MCPhysReg [8]’ {aka ‘const short unsigned int [8]’} [-Warray-bounds=]
   88 |   Inst.addOperand(MCOperand::createReg(Regs[RegNo]));
      |                                        ~~~~^
/home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp: In function ‘DecodeStatus llvm::decodeToMCInst(DecodeStatus, unsigned int, InsnType, MCInst&, uint64_t, const MCDisassembler*, bool&) [with InsnType = long unsigned int]’:
/home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h:279:26: note: object ‘CRRegs’ of size 16
  279 |   static const MCPhysReg CRRegs[8] = PPC_REGS0_7(PPC::CR);                     \
      |                          ^~~~~~
/home/user/CLionProjects/llvm-project/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp:20:1: note: in expansion of macro ‘DEFINE_PPC_REGCLASSES’
   20 | DEFINE_PPC_REGCLASSES
      | ^~~~~~~~~~~~~~~~~~~~~

This is just a excerpt. There are lots of them.

I am using gcc (GCC) 14.2.1 20240910 on Manjaro Linux.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions