From: Mark Wielaard Date: Sat, 20 Oct 2018 11:20:30 +0000 (+0200) Subject: backends: ppc use define instead of const for size of dwarf_regs array. X-Git-Tag: elfutils-0.175~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a74c190a2b357c6318e6222ff08c5bcee2f9291;p=thirdparty%2Felfutils.git backends: ppc use define instead of const for size of dwarf_regs array. The size of the dwarf_regs is a constant, but when building without optimizations the compiler doesn't see that and will warn that it cannot proof the stack size is bounded. Use a define instead of a const, so the compiler will use a constant expression everywhere. Signed-off-by: Mark Wielaard --- diff --git a/backends/ChangeLog b/backends/ChangeLog index a7434dd2d..768c270bb 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2018-10-20 Mark Wielaard + + * ppc_initreg.c (ppc_set_initial_registers_tid): Use define instead of + const for size of dwarf_regs array. + 2018-10-02 Andreas Schwab * riscv_symbol.c (riscv_reloc_simple_type): Add parameter addsub. diff --git a/backends/ppc_initreg.c b/backends/ppc_initreg.c index 3e4432f65..0e0d3599e 100644 --- a/backends/ppc_initreg.c +++ b/backends/ppc_initreg.c @@ -93,11 +93,11 @@ ppc_set_initial_registers_tid (pid_t tid __attribute__ ((unused)), if (errno != 0) return false; } - const size_t gprs = sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr); - Dwarf_Word dwarf_regs[gprs]; - for (unsigned gpr = 0; gpr < gprs; gpr++) +#define GPRS (sizeof (user_regs.r.gpr) / sizeof (*user_regs.r.gpr)) + Dwarf_Word dwarf_regs[GPRS]; + for (unsigned gpr = 0; gpr < GPRS; gpr++) dwarf_regs[gpr] = user_regs.r.gpr[gpr]; - if (! setfunc (0, gprs, dwarf_regs, arg)) + if (! setfunc (0, GPRS, dwarf_regs, arg)) return false; dwarf_regs[0] = user_regs.r.link; // LR uses both 65 and 108 numbers, there is no consistency for it.