Insufficient information. Version of Go? Since formatBits is private we need to see the actual code of a call to a public API that resulted in the call to formatBits that failed. Also, show us the literal panic stack. Showing us the assembly code with no context is not useful. If your program using pure Go (statically linked) or Cgo? Wild guesses, what I used to call SWAGS (silly wild ass guesses) as a Unix support engineer, are seldom useful. If your guess is scientifically informed that is a different matter but you should be able to articulate why you think your guess is more likely to be true than a random coin flip.
On Wed, Aug 16, 2023 at 8:31 PM metronome <xiangdong...@gmail.com> wrote: > Hi, > > We ran into a weird *out of range* issue of *strconv.formatBits*, hope > someone can shed a light on what could be the root cause, any comment is > highly appreciated. > > problem description: > * random out of range at code > <https://github.com/golang/go/blob/release-branch.go1.20/src/strconv/itoa.go#L140>, > most of the time the indexing is a huge int but we observed at least one > exception (#2).* > > * #1: runtime error: index out of range [18446744073709449339] with > length 200* > * #2: runtime error: index out of range [102511] with length 200* > > Wild guesses: > 1. The machine code seems to suggest it's unlikely a data race or memory > corruption? But perhaps > relevant registers, like R10, had been saved and restored, then it might > be due to stack corruption? > Given that R12 is scratch reg, is it possible that R12 is clobbered > somehow, say, by signal handling? > > =================================================================== > 0x0000000000495b0a<+810>: mov %rdi,%r10 > > 0x0000000000495b0d<+813>: shr %rdi > > 0x0000000000495b10<+816>: mov %rax,%rsi > > 0x0000000000495b13<+819>: movabs $0xa3d70a3d70a3d70b,%rax > > 0x0000000000495b1d<+829>: mov %rdx,%r11 > > 0x0000000000495b20<+832>: mul %rdi > > 0x0000000000495b23<+835>: shr $0x5,%rdx > > * 0x0000000000495b27<+839>: imul $0x64,%rdx,%r12* > > * 0x0000000000495b2b<+843>: sub %r12,%r10* > > * 0x0000000000495b2e<+846>: lea (%r10,%r10,1),%rax* > > 0x0000000000495b32<+850>: lea 0x1(%rax),%rax > > 0x0000000000495b36<+854>: nopw 0x0(%rax,%rax,1) > > 0x0000000000495b3f<+863>: nop > > 0x0000000000495b40<+864>: cmp $0xc8,%rax > > 0x0000000000495b46<+870>: jae 0x495c8f > <strconv.formatBits+1199> > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/ff804d4c-24ee-480d-8ed1-219f9b8d7cbcn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/ff804d4c-24ee-480d-8ed1-219f9b8d7cbcn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_t6vWM1gHojz_waK%3Ddq1wRDh8yWrvGFPSy9QteZV18pg%40mail.gmail.com.