aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-08-22 03:04:14 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-08-22 03:04:14 +0000
commit397f58bb0b63c9a40218f257d6c21922931b17f9 (patch)
tree9253e5040d27b589be6c18da82479d9410f7f76c /test
parent4afd6c37c7f6d5245e75bd2148ffc2aee959409e (diff)
downloadexternal_llvm-397f58bb0b63c9a40218f257d6c21922931b17f9.zip
external_llvm-397f58bb0b63c9a40218f257d6c21922931b17f9.tar.gz
external_llvm-397f58bb0b63c9a40218f257d6c21922931b17f9.tar.bz2
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3447 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/LLC/badidx.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/LLC/badidx.c b/test/LLC/badidx.c
new file mode 100644
index 0000000..cde897d
--- /dev/null
+++ b/test/LLC/badidx.c
@@ -0,0 +1,26 @@
+/* -*- mode: c -*-
+ * $Id$
+ * http://www.bagley.org/~doug/shootout/
+ *
+ * this program is modified from:
+ * http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html
+ * Timing Trials, or, the Trials of Timing: Experiments with Scripting
+ * and User-Interface Languages</a> by Brian W. Kernighan and
+ * Christopher J. Van Wyk.
+ *
+ * I added free() to deallocate memory.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main(int argc, char *argv[]) {
+ int i, n = ((argc == 2) ? atoi(argv[1]) : 1);
+ int *y = (int *) calloc(n, sizeof(int));
+ for (i=0; i < n; i++)
+ y[i] = i*i;
+ printf("%d\n", y[n-1]);
+ return(0);
+}
+