blob: ba3afcc77afa42dd4a636877329034f660a11cc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// We should not blow up the stack with numerous allocas
#include <stdio.h>
#include <stdlib.h>
func(int i) {
char *pc = (char *)alloca(100);
*pc = i;
(*pc)++;
return (*pc) % 10;
}
int main() {
int total = 0;
for (int i = 0; i < 1024 * 1024; i++) total += func(i);
printf("ok:%d*\n", total);
return 0;
}
|