[llvm-commits] [release_13] CVS: llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c

John Criswell criswell at cs.uiuc.edu
Thu Aug 12 11:49:36 PDT 2004



Changes in directory llvm/test/Programs/SingleSource/Regression/C:

2004-08-12-InlinerAndAllocas.c added (r1.1.2.1)
---
Log message:

Regression test for a bug that broken 176.gcc.


---
Diffs of the changes:  (+21 -0)

Index: llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c
diff -c /dev/null llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c:1.1.2.1
*** /dev/null	Thu Aug 12 13:49:34 2004
--- llvm/test/Programs/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c	Thu Aug 12 13:49:23 2004
***************
*** 0 ****
--- 1,21 ----
+ // A compiler cannot inline Callee into main unless it is prepared to reclaim
+ // the stack memory allocated in it.
+ 
+ #include <alloca.h>
+ #include <stdio.h>
+ 
+ static int Callee(int i) {
+   if (i != 0) {
+     char *X = alloca(1000);
+     sprintf(X, "%d\n", i);
+     return X[0];
+   }
+   return 0;
+ }
+ 
+ int main() {
+   int i, j = 0;
+   for (i = 0; i < 10000; ++i)
+     j += Callee(i);
+   printf("%d\n", j);
+ }






More information about the llvm-commits mailing list