fixes #13698 [backport:1.2] (#14175)

This commit is contained in:
Andreas Rumpf 2020-04-30 22:45:02 +02:00 • committed by GitHub
commit 89be5be03e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -45,9 +45,9 @@ proc nimCmpMem*(a, b: pointer, size: Natural): cint {.compilerproc, nonReloadabl
if d != 0: return d
inc i
proc nimCStrLen*(a: cstring): csize_t {.compilerproc, nonReloadable, inline.} =
proc nimCStrLen*(a: cstring): int {.compilerproc, nonReloadable, inline.} =
when useLibC:
c_strlen(a)
cast[int](c_strlen(a))
else:
var a = cast[ptr byte](a)
while a[] != 0:

View file

@ -41,3 +41,8 @@ except OverflowDefect, RangeDefect:
echo x
echo expected == 4
# bug #13698
var
x45 = "hello".cstring
p = x45.len.int32