summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorIco Doornekamp <ico@pruts.nl>2020-02-04 17:39:27 +0100
committerGitHub <noreply@github.com>2020-02-04 17:39:27 +0100
commitbfe96e069bbdfbbb7ee8979648abeaba233dfe19 (patch)
tree0149cc94797bfba2f94870c2120b075d29aa4c96 /tests/arc
parent7cc03b43f86eb521aca8347d267b9adc04db4259 (diff)
downloadNim-bfe96e069bbdfbbb7ee8979648abeaba233dfe19.tar.gz
Fixed codegen for constant cstring with --gc:arc (#13326)
* Fixed codegen for constant cstring with --gc:arc, fixes  #13321

* Added test for #13321
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/tcstring.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/arc/tcstring.nim b/tests/arc/tcstring.nim
new file mode 100644
index 000000000..79c8a7fcf
--- /dev/null
+++ b/tests/arc/tcstring.nim
@@ -0,0 +1,16 @@
+discard """
+  cmd: "nim c --gc:arc -r $file"
+  nimout: '''hello
+h
+o
+'''
+"""
+
+# Issue #13321: [codegen] --gc:arc does not properly emit cstring, results in SIGSEGV
+
+let a = "hello".cstring
+echo a
+echo a[0]
+echo a[4]
+doAssert a[a.len] == '\0'
+