Skip to content

Commit

Permalink
fixes #13698 [backport:1.2]
Browse files Browse the repository at this point in the history
  • Loading branch information
Araq committed Apr 30, 2020
1 parent 4d799f8 commit d89ed54
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 OverflowDefect, RangeDefect:
echo x

echo expected == 4

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

0 comments on commit d89ed54

Please sign in to comment.