Added inline constant expressions, including uses in binary subtract.
[oota-llvm.git] / test / LLC / badidx.c
1 /* -*- mode: c -*-
2  * $Id$
3  * http://www.bagley.org/~doug/shootout/
4  *
5  * this program is modified from:
6  *   http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html
7  * Timing Trials, or, the Trials of Timing: Experiments with Scripting
8  * and User-Interface Languages</a> by Brian W. Kernighan and
9  * Christopher J. Van Wyk.
10  *
11  * I added free() to deallocate memory.
12  */
13
14 #include <stdio.h>
15 #include <stdlib.h>
16
17 int
18 main(int argc, char *argv[]) {
19     int i, n = ((argc == 2) ? atoi(argv[1]) : 1);
20     int *y = (int *) calloc(n, sizeof(int));
21     for (i=0; i < n; i++)
22       y[i] = i*i;
23     printf("%d\n", y[n-1]);
24     return(0);
25 }
26