mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-01 04:20:09 +08:00
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
This commit is contained in:
parent
bbcb54a1f4
commit
bd489a4815
21
tests/tests2/78_vla_label.c
Normal file
21
tests/tests2/78_vla_label.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* 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;
|
||||
}
|
2
tests/tests2/78_vla_label.expect
Normal file
2
tests/tests2/78_vla_label.expect
Normal file
@ -0,0 +1,2 @@
|
||||
boom!
|
||||
boom!
|
@ -96,7 +96,8 @@ TESTS = \
|
||||
74_nocode_wanted.test \
|
||||
75_array_in_struct_init.test \
|
||||
76_dollars_in_identifiers.test \
|
||||
77_push_pop_macro.test
|
||||
77_push_pop_macro.test \
|
||||
78_vla_label.test
|
||||
|
||||
# 34_array_assignment.test -- array assignment is not in C standard
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user