Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #13698 [backport:1.2] #14175

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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