From bd489a48153aeb24ffa5eccb1fa0199f9c7ea994 Mon Sep 17 00:00:00 2001 From: Philip Date: Mon, 27 Apr 2015 14:41:57 +0000 Subject: add test case for VLA segfaults This test obviously shouldn't segfault, but currently does so. The problem is in the VLA code, which fails to save the stack pointer before taking a conditional branch in some cases. See this thread: http://lists.nongnu.org/archive/html/tinycc-devel/2015-04/msg00130.html --- tests/tests2/78_vla_label.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/tests2/78_vla_label.c (limited to 'tests/tests2/78_vla_label.c') diff --git a/tests/tests2/78_vla_label.c b/tests/tests2/78_vla_label.c new file mode 100644 index 0000000..0908e1b --- /dev/null +++ b/tests/tests2/78_vla_label.c @@ -0,0 +1,21 @@ +#include + +/* This test segfaults as of April 27, 2015. */ + +void f(int argc) +{ + char test[argc]; + if(0) + label: + printf("boom!\n"); + if(argc-- == 0) + return; + goto label; +} + +int main() +{ + f(2); + + return 0; +} -- cgit v1.3.1