summaryrefslogtreecommitdiff
path: root/tests/tcctest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcctest.c')
-rw-r--r--tests/tcctest.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index 55e356e..a2d481a 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -75,6 +75,7 @@ void stdarg_test(void);
void whitespace_test(void);
void relocation_test(void);
void old_style_function(void);
+void alloca_test(void);
void sizeof_test(void);
void typeof_test(void);
void local_label_test(void);
@@ -529,6 +530,7 @@ int main(int argc, char **argv)
whitespace_test();
relocation_test();
old_style_function();
+ alloca_test();
sizeof_test();
typeof_test();
statement_expr_test();
@@ -1935,6 +1937,18 @@ void old_style_function(void)
decl_func2(NULL);
}
+void alloca_test()
+{
+#if defined __i386__ || defined __x86_64__
+ char *p = alloca(16);
+ strcpy(p,"123456789012345");
+ printf("alloca: p is %s\n", p);
+ char *demo = "This is only a test.\n";
+ /* Test alloca embedded in a larger expression */
+ printf("alloca: %s\n", strcpy(alloca(strlen(demo)+1),demo) );
+#endif
+}
+
void sizeof_test(void)
{
int a;