fix #15617(fix compilation failure on -d:useMalloc --gc:none) (#17555)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
72988509ba
commit
7c09e0c757
2 changed files with 16 additions and 0 deletions
|
|
@ -57,6 +57,16 @@ elif defined(gogc):
|
||||||
elif (defined(nogc) or defined(gcDestructors)) and defined(useMalloc):
|
elif (defined(nogc) or defined(gcDestructors)) and defined(useMalloc):
|
||||||
include system / mm / malloc
|
include system / mm / malloc
|
||||||
|
|
||||||
|
when defined(nogc):
|
||||||
|
proc GC_getStatistics(): string = ""
|
||||||
|
proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} =
|
||||||
|
result = alloc0(size)
|
||||||
|
|
||||||
|
proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} =
|
||||||
|
result = newObj(typ, align(GenericSeqSize, typ.align) + len * typ.base.size)
|
||||||
|
cast[PGenericSeq](result).len = len
|
||||||
|
cast[PGenericSeq](result).reserved = len
|
||||||
|
|
||||||
elif defined(nogc):
|
elif defined(nogc):
|
||||||
include system / mm / none
|
include system / mm / none
|
||||||
|
|
||||||
|
|
|
||||||
6
tests/system/tgcnone.nim
Normal file
6
tests/system/tgcnone.nim
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--gc:none -d:useMalloc"
|
||||||
|
"""
|
||||||
|
# bug #15617
|
||||||
|
let x = 4
|
||||||
|
doAssert x == 4
|
||||||
Loading…
Add table
Add a link
Reference in a new issue