Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 authored and Araq committed Nov 7, 2019
1 parent 8b1ef8e commit a2d6691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/system/gc_regions.nim
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,13 @@ proc asgnRefNoCycle(dest: PPointer, src: pointer) {.compilerproc, inline,
deprecated: "old compiler compat".} = asgnRef(dest, src)

proc alloc(size: Natural): pointer =
result = c_malloc(size)
result = c_malloc(cast[csize_t](size))
if result == nil: raiseOutOfMem()
proc alloc0(size: Natural): pointer =
result = alloc(size)
zeroMem(result, size)
proc realloc(p: pointer, newsize: Natural): pointer =
result = c_realloc(p, newsize)
result = c_realloc(p, cast[csize_t](newsize))
if result == nil: raiseOutOfMem()
proc dealloc(p: pointer) = c_free(p)

Expand All @@ -401,13 +401,13 @@ proc alloc(r: var MemRegion; size: Natural): pointer =
proc dealloc(r: var MemRegion; p: pointer) = dealloc(p)

proc allocShared(size: Natural): pointer =
result = c_malloc(size)
result = c_malloc(cast[csize_t](size))
if result == nil: raiseOutOfMem()
proc allocShared0(size: Natural): pointer =
result = alloc(size)
zeroMem(result, size)
proc reallocShared(p: pointer, newsize: Natural): pointer =
result = c_realloc(p, newsize)
result = c_realloc(p, cast[csize_t](newsize))
if result == nil: raiseOutOfMem()
proc deallocShared(p: pointer) = c_free(p)

Expand Down
6 changes: 6 additions & 0 deletions tests/misc/tgcregions.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
discard """
cmd: "nim c --gc:regions $file"
"""

# issue #12597
# it just tests that --gc:regions compiles. Nothing else. :'(

0 comments on commit a2d6691

Please sign in to comment.