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
Unified · Split
| @@ -0,0 +1,21 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | |||
| 3 | /* This test segfaults as of April 27, 2015. */ | ||
| 4 | |||
| 5 | void f(int argc) | ||
| 6 | { | ||
| 7 | char test[argc]; | ||
| 8 | if(0) | ||
| 9 | label: | ||
| 10 | printf("boom!\n"); | ||
| 11 | if(argc-- == 0) | ||
| 12 | return; | ||
| 13 | goto label; | ||
| 14 | } | ||
| 15 | |||
| 16 | int main() | ||
| 17 | { | ||
| 18 | f(2); | ||
| 19 | |||
| 20 | return 0; | ||
| 21 | } | ||
| @@ -0,0 +1,2 @@ | |||
| 1 | boom! | ||
| 2 | boom! | ||
| @@ -96,7 +96,8 @@ TESTS = \ · 95 unmodified lines | |||
| 96 | 74_nocode_wanted.test \ | 96 | 74_nocode_wanted.test \ |
| 97 | 75_array_in_struct_init.test \ | 97 | 75_array_in_struct_init.test \ |
| 98 | 76_dollars_in_identifiers.test \ | 98 | 76_dollars_in_identifiers.test \ |
| 99 | 77_push_pop_macro.test | 99 | 77_push_pop_macro.test \ |
| 100 | 78_vla_label.test | ||
| 100 | 101 | ||
| 101 | # 34_array_assignment.test -- array assignment is not in C standard | 102 | # 34_array_assignment.test -- array assignment is not in C standard |
| 102 | 103 | ||