Skip to content

Commit

Permalink
fixes #13698 [backport:1.2] (#14175)
Browse files Browse the repository at this point in the history
(cherry picked from commit 89be5be)
  • Loading branch information
Araq authored and narimiran committed May 6, 2020
1 parent b997e32 commit 62b9dcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/system/memory.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions tests/misc/trangechecks.nim
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ except OverflowError, RangeError:
echo x

echo expected == 4

# bug #13698
var
x45 = "hello".cstring
p = x45.len.int32

0 comments on commit 62b9dcb

Please sign in to comment.