From 397f58bb0b63c9a40218f257d6c21922931b17f9 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Thu, 22 Aug 2002 03:04:14 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3447 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/LLC/badidx.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/LLC/badidx.c diff --git a/test/LLC/badidx.c b/test/LLC/badidx.c new file mode 100644 index 00000000000..cde897d0bed --- /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 by Brian W. Kernighan and + * Christopher J. Van Wyk. + * + * I added free() to deallocate memory. + */ + +#include +#include + +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); +} +