fixes #23936; opcParseFloat accepts the wrong register as the first param [backport] (#23941)

fixes #23936
follow up https://github.com/nim-lang/Nim/pull/20527
This commit is contained in:
ringabout
2024-08-12 20:43:13 +08:00
committed by GitHub
parent e0e698be9a
commit b215ec3735
2 changed files with 12 additions and 1 deletions

View File

@@ -99,3 +99,14 @@ block: # With this included, static: test() crashes the compiler (from a
checkParseSize " 12" , 0, 1 # Leading white
# Value Edge cases
checkParseSize "9223372036854775807", 19, int64.high
block: # bug #23936
func parsePyFloat(
a: openArray[char], # here must be openArray instead of string to reproduce this bug
res: var BiggestFloat): int =
result = parseFloat(a, res)
static:
var f = 0.0
doAssert "1.0".parsePyFloat(f) == 3
doAssert f == 1.0