Hi Serhei, On Thu, Apr 9, 2026 at 4:07 PM Serhei Makarov <[email protected]> wrote: > On Sun, Apr 5, 2026, at 8:24 PM, Aaron Merey wrote: > >> @@ -84,8 +84,8 @@ generic_sample_sp_pc (const Dwarf_Word *regs, uint32_t > >> n_regs, > >> /* TODO: Register locations could be cached and rechecked on a > >> fastpath without needing to loop, though the overhead reduction > >> is minimal. */ > >> - int j, need_sp = (sp != NULL), need_pc = (pc != NULL); > >> - for (j = 0; (need_sp || need_pc) && n_regs_mapping > (uint32_t)j; j++) > >> + int need_sp = (sp != NULL), need_pc = (pc != NULL); > >> + for (size_t j = 0; (need_sp || need_pc) && n_regs_mapping > j; j++) > >> { > >> if (n_regs < (uint32_t)j) break; > > > > This cast will truncate j when size_t is uint64_t, although having > > more than 2^32 registers is unlikely. > Agreed, don't see a better way to do this. > The comparison will be fixed to use <= in the revised patch (cf the > discussion on patch1), > so even in a deliberately-pathological case we would have j reach UINT32_MAX > and trigger this correctly.
Ack. Aaron
