From: Kirill A. Korinsky Subject: Re: llvm SparcAsmParser off by one To: Mark Kettenis Cc: Theo Buehler , tech@openbsd.org Date: Fri, 21 Aug 2026 14:26:25 +0200 On Fri, 21 Aug 2026 13:00:10 +0200, Mark Kettenis wrote: > > > Date: Fri, 21 Aug 2026 09:06:58 +0200 > > From: Theo Buehler > > > > The build of lang/rust on sparc64 with llvm errors out: > > > > warning: psm@0.1.26: src/arch/sparc64.s:59:26: error: invalid register name > > warning: psm@0.1.26: .cfi_register %r15, %r31 > > warning: psm@0.1.26: ^ > > error: failed to run custom build command for `psm v0.1.26` > > > > This is because of an off by one rejecting %r31. Not sure if this or > > <= 31 would be preferred. I'll sync this to ports of course. > > > > diff --git a/gnu/llvm/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp b/gnu/llvm/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp > > index e5c7fa86b3..a9fa9ba769 100644 > > --- a/gnu/llvm/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp > > +++ b/gnu/llvm/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp > > @@ -1614,7 +1614,7 @@ > > // %r0 - %r31 > > int64_t RegNo = 0; > > if (Name.starts_with_insensitive("r") && > > - !Name.substr(1, 2).getAsInteger(10, RegNo) && RegNo < 31) { > > + !Name.substr(1, 2).getAsInteger(10, RegNo) && RegNo < 32) { > > RegKind = SparcOperand::rk_IntReg; > > return IntRegs[RegNo]; > > } > > > > I'd probably have used <= 31 given the code in MorphToIntPairReg(), > but either way, ok kettenis@ > Yes, I think it is a typo <= -> < Also, I think it need to be upstreamed Anyway OK kirill@ -- wbr, Kirill