From ab26298a035ed794fc73724a6ae06eefd6c764d3 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 4 Aug 2015 17:31:00 +0200 Subject: added system.unsafeAddr --- tests/ccgbugs/tunsafeaddr.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/ccgbugs/tunsafeaddr.nim (limited to 'tests/ccgbugs/tunsafeaddr.nim') diff --git a/tests/ccgbugs/tunsafeaddr.nim b/tests/ccgbugs/tunsafeaddr.nim new file mode 100644 index 000000000..4f05c7c21 --- /dev/null +++ b/tests/ccgbugs/tunsafeaddr.nim @@ -0,0 +1,19 @@ +discard """ + output: '''12''' +""" + +{.emit: """ +long sum(long* a, long len) { + long i, result = 0; + for (i = 0; i < len; ++i) result += a[i]; + return result; +} +""".} + +proc sum(a: ptr int; len: int): int {.importc, nodecl.} + +proc main = + let foo = [8, 3, 1] + echo sum(unsafeAddr foo[0], foo.len) + +main() -- cgit 1.4.1-2-gfad0 hes'> Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.Kartik K. Agaram <vc@akkartik.com>
about summary refs log tree commit diff stats
path: root/073scenario_screen_test.mu
blob: fa1a026c7ac740acdfa9615e192fc5c5cfff136d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29