summaryrefslogtreecommitdiff
path: root/05/tcc-0.9.27/tests/tests2
diff options
context:
space:
mode:
Diffstat (limited to '05/tcc-0.9.27/tests/tests2')
-rw-r--r--05/tcc-0.9.27/tests/tests2/00_assignment.c18
-rw-r--r--05/tcc-0.9.27/tests/tests2/00_assignment.expect3
-rw-r--r--05/tcc-0.9.27/tests/tests2/01_comment.c14
-rw-r--r--05/tcc-0.9.27/tests/tests2/01_comment.expect5
-rw-r--r--05/tcc-0.9.27/tests/tests2/02_printf.c18
-rw-r--r--05/tcc-0.9.27/tests/tests2/02_printf.expect15
-rw-r--r--05/tcc-0.9.27/tests/tests2/03_struct.c31
-rw-r--r--05/tcc-0.9.27/tests/tests2/03_struct.expect6
-rw-r--r--05/tcc-0.9.27/tests/tests2/04_for.c15
-rw-r--r--05/tcc-0.9.27/tests/tests2/04_for.expect10
-rw-r--r--05/tcc-0.9.27/tests/tests2/05_array.c21
-rw-r--r--05/tcc-0.9.27/tests/tests2/05_array.expect10
-rw-r--r--05/tcc-0.9.27/tests/tests2/06_case.c29
-rw-r--r--05/tcc-0.9.27/tests/tests2/06_case.expect8
-rw-r--r--05/tcc-0.9.27/tests/tests2/07_function.c30
-rw-r--r--05/tcc-0.9.27/tests/tests2/07_function.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/08_while.c24
-rw-r--r--05/tcc-0.9.27/tests/tests2/08_while.expect11
-rw-r--r--05/tcc-0.9.27/tests/tests2/09_do_while.c24
-rw-r--r--05/tcc-0.9.27/tests/tests2/09_do_while.expect11
-rw-r--r--05/tcc-0.9.27/tests/tests2/10_pointer.c40
-rw-r--r--05/tcc-0.9.27/tests/tests2/10_pointer.expect8
-rw-r--r--05/tcc-0.9.27/tests/tests2/11_precedence.c40
-rw-r--r--05/tcc-0.9.27/tests/tests2/11_precedence.expect15
-rw-r--r--05/tcc-0.9.27/tests/tests2/12_hashdefine.c14
-rw-r--r--05/tcc-0.9.27/tests/tests2/12_hashdefine.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/13_integer_literals.c20
-rw-r--r--05/tcc-0.9.27/tests/tests2/13_integer_literals.expect5
-rw-r--r--05/tcc-0.9.27/tests/tests2/14_if.c21
-rw-r--r--05/tcc-0.9.27/tests/tests2/14_if.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/15_recursion.c21
-rw-r--r--05/tcc-0.9.27/tests/tests2/15_recursion.expect10
-rw-r--r--05/tcc-0.9.27/tests/tests2/16_nesting.c21
-rw-r--r--05/tcc-0.9.27/tests/tests2/16_nesting.expect18
-rw-r--r--05/tcc-0.9.27/tests/tests2/17_enum.c72
-rw-r--r--05/tcc-0.9.27/tests/tests2/17_enum.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/18_include.c12
-rw-r--r--05/tcc-0.9.27/tests/tests2/18_include.expect3
-rw-r--r--05/tcc-0.9.27/tests/tests2/18_include.h1
-rw-r--r--05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.c28
-rw-r--r--05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.expect3
-rw-r--r--05/tcc-0.9.27/tests/tests2/20_pointer_comparison.c24
-rw-r--r--05/tcc-0.9.27/tests/tests2/20_pointer_comparison.expect6
-rw-r--r--05/tcc-0.9.27/tests/tests2/21_char_array.c33
-rw-r--r--05/tcc-0.9.27/tests/tests2/21_char_array.expect7
-rw-r--r--05/tcc-0.9.27/tests/tests2/22_floating_point.c50
-rw-r--r--05/tcc-0.9.27/tests/tests2/22_floating_point.expect16
-rw-r--r--05/tcc-0.9.27/tests/tests2/23_type_coercion.c54
-rw-r--r--05/tcc-0.9.27/tests/tests2/23_type_coercion.expect12
-rw-r--r--05/tcc-0.9.27/tests/tests2/24_math_library.c30
-rw-r--r--05/tcc-0.9.27/tests/tests2/24_math_library.expect18
-rw-r--r--05/tcc-0.9.27/tests/tests2/25_quicksort.c83
-rw-r--r--05/tcc-0.9.27/tests/tests2/25_quicksort.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/26_character_constants.c17
-rw-r--r--05/tcc-0.9.27/tests/tests2/26_character_constants.expect8
-rw-r--r--05/tcc-0.9.27/tests/tests2/27_sizeof.c18
-rw-r--r--05/tcc-0.9.27/tests/tests2/27_sizeof.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/28_strings.c45
-rw-r--r--05/tcc-0.9.27/tests/tests2/28_strings.expect19
-rw-r--r--05/tcc-0.9.27/tests/tests2/29_array_address.c13
-rw-r--r--05/tcc-0.9.27/tests/tests2/29_array_address.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/30_hanoi.c122
-rw-r--r--05/tcc-0.9.27/tests/tests2/30_hanoi.expect71
-rw-r--r--05/tcc-0.9.27/tests/tests2/31_args.c14
-rw-r--r--05/tcc-0.9.27/tests/tests2/31_args.expect6
-rw-r--r--05/tcc-0.9.27/tests/tests2/32_led.c266
-rw-r--r--05/tcc-0.9.27/tests/tests2/32_led.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/33_ternary_op.c15
-rw-r--r--05/tcc-0.9.27/tests/tests2/33_ternary_op.expect10
-rw-r--r--05/tcc-0.9.27/tests/tests2/34_array_assignment.c23
-rw-r--r--05/tcc-0.9.27/tests/tests2/34_array_assignment.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/35_sizeof.c14
-rw-r--r--05/tcc-0.9.27/tests/tests2/35_sizeof.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/36_array_initialisers.c21
-rw-r--r--05/tcc-0.9.27/tests/tests2/36_array_initialisers.expect20
-rw-r--r--05/tcc-0.9.27/tests/tests2/37_sprintf.c17
-rw-r--r--05/tcc-0.9.27/tests/tests2/37_sprintf.expect20
-rw-r--r--05/tcc-0.9.27/tests/tests2/38_multiple_array_index.c32
-rw-r--r--05/tcc-0.9.27/tests/tests2/38_multiple_array_index.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/39_typedef.c65
-rw-r--r--05/tcc-0.9.27/tests/tests2/39_typedef.expect3
-rw-r--r--05/tcc-0.9.27/tests/tests2/40_stdio.c52
-rw-r--r--05/tcc-0.9.27/tests/tests2/40_stdio.expect27
-rw-r--r--05/tcc-0.9.27/tests/tests2/41_hashif.c85
-rw-r--r--05/tcc-0.9.27/tests/tests2/41_hashif.expect6
-rw-r--r--05/tcc-0.9.27/tests/tests2/42_function_pointer.c22
-rw-r--r--05/tcc-0.9.27/tests/tests2/42_function_pointer.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/43_void_param.c15
-rw-r--r--05/tcc-0.9.27/tests/tests2/43_void_param.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/44_scoped_declarations.c17
-rw-r--r--05/tcc-0.9.27/tests/tests2/44_scoped_declarations.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/45_empty_for.c18
-rw-r--r--05/tcc-0.9.27/tests/tests2/45_empty_for.expect10
-rw-r--r--05/tcc-0.9.27/tests/tests2/46_grep.c568
-rw-r--r--05/tcc-0.9.27/tests/tests2/46_grep.expect3
-rw-r--r--05/tcc-0.9.27/tests/tests2/47_switch_return.c24
-rw-r--r--05/tcc-0.9.27/tests/tests2/47_switch_return.expect4
-rw-r--r--05/tcc-0.9.27/tests/tests2/48_nested_break.c26
-rw-r--r--05/tcc-0.9.27/tests/tests2/48_nested_break.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.c23
-rw-r--r--05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/50_logical_second_arg.c29
-rw-r--r--05/tcc-0.9.27/tests/tests2/50_logical_second_arg.expect20
-rw-r--r--05/tcc-0.9.27/tests/tests2/51_static.c30
-rw-r--r--05/tcc-0.9.27/tests/tests2/51_static.expect8
-rw-r--r--05/tcc-0.9.27/tests/tests2/52_unnamed_enum.c27
-rw-r--r--05/tcc-0.9.27/tests/tests2/52_unnamed_enum.expect9
-rw-r--r--05/tcc-0.9.27/tests/tests2/54_goto.c56
-rw-r--r--05/tcc-0.9.27/tests/tests2/54_goto.expect8
-rw-r--r--05/tcc-0.9.27/tests/tests2/55_lshift_type.c52
-rw-r--r--05/tcc-0.9.27/tests/tests2/55_lshift_type.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.c51
-rw-r--r--05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.expect28
-rw-r--r--05/tcc-0.9.27/tests/tests2/64_macro_nesting.c12
-rw-r--r--05/tcc-0.9.27/tests/tests2/64_macro_nesting.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/67_macro_concat.c14
-rw-r--r--05/tcc-0.9.27/tests/tests2/67_macro_concat.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/70_floating_point_literals.c77
-rw-r--r--05/tcc-0.9.27/tests/tests2/70_floating_point_literals.expect53
-rw-r--r--05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.c9
-rw-r--r--05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/72_long_long_constant.c19
-rw-r--r--05/tcc-0.9.27/tests/tests2/72_long_long_constant.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/73_arm64.c527
-rw-r--r--05/tcc-0.9.27/tests/tests2/73_arm64.expect174
-rw-r--r--05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.c33
-rw-r--r--05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.expect72
-rw-r--r--05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.c41
-rw-r--r--05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.expect14
-rw-r--r--05/tcc-0.9.27/tests/tests2/77_push_pop_macro.c30
-rw-r--r--05/tcc-0.9.27/tests/tests2/77_push_pop_macro.expect5
-rw-r--r--05/tcc-0.9.27/tests/tests2/78_vla_label.c45
-rw-r--r--05/tcc-0.9.27/tests/tests2/78_vla_label.expect6
-rw-r--r--05/tcc-0.9.27/tests/tests2/79_vla_continue.c116
-rw-r--r--05/tcc-0.9.27/tests/tests2/79_vla_continue.expect5
-rw-r--r--05/tcc-0.9.27/tests/tests2/80_flexarray.c25
-rw-r--r--05/tcc-0.9.27/tests/tests2/80_flexarray.expect0
-rw-r--r--05/tcc-0.9.27/tests/tests2/81_types.c43
-rw-r--r--05/tcc-0.9.27/tests/tests2/81_types.expect0
-rw-r--r--05/tcc-0.9.27/tests/tests2/82_attribs_position.c19
-rw-r--r--05/tcc-0.9.27/tests/tests2/82_attribs_position.expect0
-rw-r--r--05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.c9
-rw-r--r--05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/84_hex-float.c12
-rw-r--r--05/tcc-0.9.27/tests/tests2/84_hex-float.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/85_asm-outside-function.c9
-rw-r--r--05/tcc-0.9.27/tests/tests2/85_asm-outside-function.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/86_memory-model.c38
-rw-r--r--05/tcc-0.9.27/tests/tests2/86_memory-model.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/87_dead_code.c122
-rw-r--r--05/tcc-0.9.27/tests/tests2/87_dead_code.expect18
-rw-r--r--05/tcc-0.9.27/tests/tests2/88_codeopt.c68
-rw-r--r--05/tcc-0.9.27/tests/tests2/88_codeopt.expect2
-rw-r--r--05/tcc-0.9.27/tests/tests2/89_nocode_wanted.c112
-rw-r--r--05/tcc-0.9.27/tests/tests2/89_nocode_wanted.expect14
-rw-r--r--05/tcc-0.9.27/tests/tests2/90_struct-init.c282
-rw-r--r--05/tcc-0.9.27/tests/tests2/90_struct-init.expect43
-rw-r--r--05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.c15
-rw-r--r--05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/92_enum_bitfield.c57
-rw-r--r--05/tcc-0.9.27/tests/tests2/92_enum_bitfield.expect0
-rw-r--r--05/tcc-0.9.27/tests/tests2/93_integer_promotion.c71
-rw-r--r--05/tcc-0.9.27/tests/tests2/93_integer_promotion.expect46
-rw-r--r--05/tcc-0.9.27/tests/tests2/94_generic.c64
-rw-r--r--05/tcc-0.9.27/tests/tests2/94_generic.expect13
-rw-r--r--05/tcc-0.9.27/tests/tests2/95_bitfields.c218
-rw-r--r--05/tcc-0.9.27/tests/tests2/95_bitfields.expect149
-rw-r--r--05/tcc-0.9.27/tests/tests2/95_bitfields_ms.c2
-rw-r--r--05/tcc-0.9.27/tests/tests2/95_bitfields_ms.expect149
-rw-r--r--05/tcc-0.9.27/tests/tests2/96_nodata_wanted.c84
-rw-r--r--05/tcc-0.9.27/tests/tests2/96_nodata_wanted.expect23
-rw-r--r--05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.c12
-rw-r--r--05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/98_al_ax_extend.c41
-rw-r--r--05/tcc-0.9.27/tests/tests2/98_al_ax_extend.expect9
-rw-r--r--05/tcc-0.9.27/tests/tests2/99_fastcall.c276
-rw-r--r--05/tcc-0.9.27/tests/tests2/99_fastcall.expect1
-rw-r--r--05/tcc-0.9.27/tests/tests2/LICENSE37
-rw-r--r--05/tcc-0.9.27/tests/tests2/Makefile112
179 files changed, 6542 insertions, 0 deletions
diff --git a/05/tcc-0.9.27/tests/tests2/00_assignment.c b/05/tcc-0.9.27/tests/tests2/00_assignment.c
new file mode 100644
index 0000000..c96109f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/00_assignment.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ a = 42;
+ printf("%d\n", a);
+
+ int b = 64;
+ printf("%d\n", b);
+
+ int c = 12, d = 34;
+ printf("%d, %d\n", c, d);
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/00_assignment.expect b/05/tcc-0.9.27/tests/tests2/00_assignment.expect
new file mode 100644
index 0000000..d4407f3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/00_assignment.expect
@@ -0,0 +1,3 @@
+42
+64
+12, 34
diff --git a/05/tcc-0.9.27/tests/tests2/01_comment.c b/05/tcc-0.9.27/tests/tests2/01_comment.c
new file mode 100644
index 0000000..a2e6bc6
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/01_comment.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("Hello\n");
+ printf("Hello\n"); /* this is a comment */ printf("Hello\n");
+ printf("Hello\n");
+ // this is also a comment sayhello();
+ printf("Hello\n");
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/01_comment.expect b/05/tcc-0.9.27/tests/tests2/01_comment.expect
new file mode 100644
index 0000000..b1387ad
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/01_comment.expect
@@ -0,0 +1,5 @@
+Hello
+Hello
+Hello
+Hello
+Hello
diff --git a/05/tcc-0.9.27/tests/tests2/02_printf.c b/05/tcc-0.9.27/tests/tests2/02_printf.c
new file mode 100644
index 0000000..4c34dd8
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/02_printf.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("Hello world\n");
+
+ int Count;
+ for (Count = -5; Count <= 5; Count++)
+ printf("Count = %d\n", Count);
+
+ printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there");
+ printf("Character 'A' is '%c'\n", 65);
+ printf("Character 'a' is '%c'\n", 'a');
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/02_printf.expect b/05/tcc-0.9.27/tests/tests2/02_printf.expect
new file mode 100644
index 0000000..f67a0f6
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/02_printf.expect
@@ -0,0 +1,15 @@
+Hello world
+Count = -5
+Count = -4
+Count = -3
+Count = -2
+Count = -1
+Count = 0
+Count = 1
+Count = 2
+Count = 3
+Count = 4
+Count = 5
+String 'hello', 'there' is 'hello', 'there'
+Character 'A' is 'A'
+Character 'a' is 'a'
diff --git a/05/tcc-0.9.27/tests/tests2/03_struct.c b/05/tcc-0.9.27/tests/tests2/03_struct.c
new file mode 100644
index 0000000..c5d48c5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/03_struct.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+struct fred
+{
+ int boris;
+ int natasha;
+};
+
+int main()
+{
+ struct fred bloggs;
+
+ bloggs.boris = 12;
+ bloggs.natasha = 34;
+
+ printf("%d\n", bloggs.boris);
+ printf("%d\n", bloggs.natasha);
+
+ struct fred jones[2];
+ jones[0].boris = 12;
+ jones[0].natasha = 34;
+ jones[1].boris = 56;
+ jones[1].natasha = 78;
+
+ printf("%d\n", jones[0].boris);
+ printf("%d\n", jones[0].natasha);
+ printf("%d\n", jones[1].boris);
+ printf("%d\n", jones[1].natasha);
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/03_struct.expect b/05/tcc-0.9.27/tests/tests2/03_struct.expect
new file mode 100644
index 0000000..ecbf589
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/03_struct.expect
@@ -0,0 +1,6 @@
+12
+34
+12
+34
+56
+78
diff --git a/05/tcc-0.9.27/tests/tests2/04_for.c b/05/tcc-0.9.27/tests/tests2/04_for.c
new file mode 100644
index 0000000..312fed8
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/04_for.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count;
+
+ for (Count = 1; Count <= 10; Count++)
+ {
+ printf("%d\n", Count);
+ }
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/04_for.expect b/05/tcc-0.9.27/tests/tests2/04_for.expect
new file mode 100644
index 0000000..f00c965
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/04_for.expect
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/05/tcc-0.9.27/tests/tests2/05_array.c b/05/tcc-0.9.27/tests/tests2/05_array.c
new file mode 100644
index 0000000..c218f31
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/05_array.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count;
+ int Array[10];
+
+ for (Count = 1; Count <= 10; Count++)
+ {
+ Array[Count-1] = Count * Count;
+ }
+
+ for (Count = 0; Count < 10; Count++)
+ {
+ printf("%d\n", Array[Count]);
+ }
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/05_array.expect b/05/tcc-0.9.27/tests/tests2/05_array.expect
new file mode 100644
index 0000000..bc7257c
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/05_array.expect
@@ -0,0 +1,10 @@
+1
+4
+9
+16
+25
+36
+49
+64
+81
+100
diff --git a/05/tcc-0.9.27/tests/tests2/06_case.c b/05/tcc-0.9.27/tests/tests2/06_case.c
new file mode 100644
index 0000000..c0191e2
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/06_case.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count;
+
+ for (Count = 0; Count < 4; Count++)
+ {
+ printf("%d\n", Count);
+ switch (Count)
+ {
+ case 1:
+ printf("%d\n", 1);
+ break;
+
+ case 2:
+ printf("%d\n", 2);
+ break;
+
+ default:
+ printf("%d\n", 0);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/06_case.expect b/05/tcc-0.9.27/tests/tests2/06_case.expect
new file mode 100644
index 0000000..fab2c20
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/06_case.expect
@@ -0,0 +1,8 @@
+0
+0
+1
+1
+2
+2
+3
+0
diff --git a/05/tcc-0.9.27/tests/tests2/07_function.c b/05/tcc-0.9.27/tests/tests2/07_function.c
new file mode 100644
index 0000000..0477ce1
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/07_function.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+int myfunc(int x)
+{
+ return x * x;
+}
+
+void vfunc(int a)
+{
+ printf("a=%d\n", a);
+}
+
+void qfunc()
+{
+ printf("qfunc()\n");
+}
+
+int main()
+{
+ printf("%d\n", myfunc(3));
+ printf("%d\n", myfunc(4));
+
+ vfunc(1234);
+
+ qfunc();
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/07_function.expect b/05/tcc-0.9.27/tests/tests2/07_function.expect
new file mode 100644
index 0000000..8ffb0a7
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/07_function.expect
@@ -0,0 +1,4 @@
+9
+16
+a=1234
+qfunc()
diff --git a/05/tcc-0.9.27/tests/tests2/08_while.c b/05/tcc-0.9.27/tests/tests2/08_while.c
new file mode 100644
index 0000000..602ffc7
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/08_while.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ int p;
+ int t;
+
+ a = 1;
+ p = 0;
+ t = 0;
+
+ while (a < 100)
+ {
+ printf("%d\n", a);
+ t = a;
+ a = t + p;
+ p = t;
+ }
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/08_while.expect b/05/tcc-0.9.27/tests/tests2/08_while.expect
new file mode 100644
index 0000000..702d4c0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/08_while.expect
@@ -0,0 +1,11 @@
+1
+1
+2
+3
+5
+8
+13
+21
+34
+55
+89
diff --git a/05/tcc-0.9.27/tests/tests2/09_do_while.c b/05/tcc-0.9.27/tests/tests2/09_do_while.c
new file mode 100644
index 0000000..1d3315d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/09_do_while.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ int p;
+ int t;
+
+ a = 1;
+ p = 0;
+ t = 0;
+
+ do
+ {
+ printf("%d\n", a);
+ t = a;
+ a = t + p;
+ p = t;
+ } while (a < 100);
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/09_do_while.expect b/05/tcc-0.9.27/tests/tests2/09_do_while.expect
new file mode 100644
index 0000000..702d4c0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/09_do_while.expect
@@ -0,0 +1,11 @@
+1
+1
+2
+3
+5
+8
+13
+21
+34
+55
+89
diff --git a/05/tcc-0.9.27/tests/tests2/10_pointer.c b/05/tcc-0.9.27/tests/tests2/10_pointer.c
new file mode 100644
index 0000000..0177f4d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/10_pointer.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+
+struct ziggy
+{
+ int a;
+ int b;
+ int c;
+} bolshevic;
+
+int main()
+{
+ int a;
+ int *b;
+ int c;
+
+ a = 42;
+ b = &a;
+ printf("a = %d\n", *b);
+
+ bolshevic.a = 12;
+ bolshevic.b = 34;
+ bolshevic.c = 56;
+
+ printf("bolshevic.a = %d\n", bolshevic.a);
+ printf("bolshevic.b = %d\n", bolshevic.b);
+ printf("bolshevic.c = %d\n", bolshevic.c);
+
+ struct ziggy *tsar = &bolshevic;
+
+ printf("tsar->a = %d\n", tsar->a);
+ printf("tsar->b = %d\n", tsar->b);
+ printf("tsar->c = %d\n", tsar->c);
+
+ b = &(bolshevic.b);
+ printf("bolshevic.b = %d\n", *b);
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/10_pointer.expect b/05/tcc-0.9.27/tests/tests2/10_pointer.expect
new file mode 100644
index 0000000..1e3c473
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/10_pointer.expect
@@ -0,0 +1,8 @@
+a = 42
+bolshevic.a = 12
+bolshevic.b = 34
+bolshevic.c = 56
+tsar->a = 12
+tsar->b = 34
+tsar->c = 56
+bolshevic.b = 34
diff --git a/05/tcc-0.9.27/tests/tests2/11_precedence.c b/05/tcc-0.9.27/tests/tests2/11_precedence.c
new file mode 100644
index 0000000..db2049d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/11_precedence.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ int b;
+ int c;
+ int d;
+ int e;
+ int f;
+ int x;
+ int y;
+
+ a = 12;
+ b = 34;
+ c = 56;
+ d = 78;
+ e = 0;
+ f = 1;
+
+ printf("%d\n", c + d);
+ printf("%d\n", (y = c + d));
+ printf("%d\n", e || e && f);
+ printf("%d\n", e || f && f);
+ printf("%d\n", e && e || f);
+ printf("%d\n", e && f || f);
+ printf("%d\n", a && f | f);
+ printf("%d\n", a | b ^ c & d);
+ printf("%d, %d\n", a == a, a == b);
+ printf("%d, %d\n", a != a, a != b);
+ printf("%d\n", a != b && c != d);
+ printf("%d\n", a + b * c / f);
+ printf("%d\n", a + b * c / f);
+ printf("%d\n", (4 << 4));
+ printf("%d\n", (64 >> 4));
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/11_precedence.expect b/05/tcc-0.9.27/tests/tests2/11_precedence.expect
new file mode 100644
index 0000000..b692396
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/11_precedence.expect
@@ -0,0 +1,15 @@
+134
+134
+0
+1
+1
+1
+1
+46
+1, 0
+0, 1
+1
+1916
+1916
+64
+4
diff --git a/05/tcc-0.9.27/tests/tests2/12_hashdefine.c b/05/tcc-0.9.27/tests/tests2/12_hashdefine.c
new file mode 100644
index 0000000..5c521e0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/12_hashdefine.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#define FRED 12
+#define BLOGGS(x) (12*(x))
+
+int main()
+{
+ printf("%d\n", FRED);
+ printf("%d, %d, %d\n", BLOGGS(1), BLOGGS(2), BLOGGS(3));
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/12_hashdefine.expect b/05/tcc-0.9.27/tests/tests2/12_hashdefine.expect
new file mode 100644
index 0000000..99f2ed5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/12_hashdefine.expect
@@ -0,0 +1,2 @@
+12
+12, 24, 36
diff --git a/05/tcc-0.9.27/tests/tests2/13_integer_literals.c b/05/tcc-0.9.27/tests/tests2/13_integer_literals.c
new file mode 100644
index 0000000..7cee98b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/13_integer_literals.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int main()
+{
+ int a = 24680;
+ int b = 01234567;
+ int c = 0x2468ac;
+ int d = 0x2468AC;
+ int e = 0b010101010101;
+
+ printf("%d\n", a);
+ printf("%d\n", b);
+ printf("%d\n", c);
+ printf("%d\n", d);
+ printf("%d\n", e);
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/13_integer_literals.expect b/05/tcc-0.9.27/tests/tests2/13_integer_literals.expect
new file mode 100644
index 0000000..f5aca06
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/13_integer_literals.expect
@@ -0,0 +1,5 @@
+24680
+342391
+2386092
+2386092
+1365
diff --git a/05/tcc-0.9.27/tests/tests2/14_if.c b/05/tcc-0.9.27/tests/tests2/14_if.c
new file mode 100644
index 0000000..2bd2550
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/14_if.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main()
+{
+ int a = 1;
+
+ if (a)
+ printf("a is true\n");
+ else
+ printf("a is false\n");
+
+ int b = 0;
+ if (b)
+ printf("b is true\n");
+ else
+ printf("b is false\n");
+
+ return 0;
+}
+
+// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
diff --git a/05/tcc-0.9.27/tests/tests2/14_if.expect b/05/tcc-0.9.27/tests/tests2/14_if.expect
new file mode 100644
index 0000000..c32c415
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/14_if.expect
@@ -0,0 +1,2 @@
+a is true
+b is false
diff --git a/05/tcc-0.9.27/tests/tests2/15_recursion.c b/05/tcc-0.9.27/tests/tests2/15_recursion.c
new file mode 100644
index 0000000..f79a00d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/15_recursion.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int factorial(int i)
+{
+ if (i < 2)
+ return i;
+ else
+ return i * factorial(i - 1);
+}
+
+int main()
+{
+ int Count;
+
+ for (Count = 1; Count <= 10; Count++)
+ printf("%d\n", factorial(Count));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/15_recursion.expect b/05/tcc-0.9.27/tests/tests2/15_recursion.expect
new file mode 100644
index 0000000..db47b28
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/15_recursion.expect
@@ -0,0 +1,10 @@
+1
+2
+6
+24
+120
+720
+5040
+40320
+362880
+3628800
diff --git a/05/tcc-0.9.27/tests/tests2/16_nesting.c b/05/tcc-0.9.27/tests/tests2/16_nesting.c
new file mode 100644
index 0000000..2b72cc0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/16_nesting.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main()
+{
+ int x, y, z;
+
+ for (x = 0; x < 2; x++)
+ {
+ for (y = 0; y < 3; y++)
+ {
+ for (z = 0; z < 3; z++)
+ {
+ printf("%d %d %d\n", x, y, z);
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/16_nesting.expect b/05/tcc-0.9.27/tests/tests2/16_nesting.expect
new file mode 100644
index 0000000..5a3431e
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/16_nesting.expect
@@ -0,0 +1,18 @@
+0 0 0
+0 0 1
+0 0 2
+0 1 0
+0 1 1
+0 1 2
+0 2 0
+0 2 1
+0 2 2
+1 0 0
+1 0 1
+1 0 2
+1 1 0
+1 1 1
+1 1 2
+1 2 0
+1 2 1
+1 2 2
diff --git a/05/tcc-0.9.27/tests/tests2/17_enum.c b/05/tcc-0.9.27/tests/tests2/17_enum.c
new file mode 100644
index 0000000..e2bc736
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/17_enum.c
@@ -0,0 +1,72 @@
+#include <stdio.h>
+
+enum fred
+{
+ a,
+ b,
+ c,
+ d,
+ e = 54,
+ f = 73,
+ g,
+ h
+};
+
+/* All following uses of enum efoo should compile
+ without warning. While forward enums aren't ISO C,
+ it's accepted by GCC also in strict mode, and only warned
+ about with -pedantic. This happens in the real world. */
+/* Strict ISO C doesn't allow this kind of forward declaration of
+ enums, but GCC accepts it (and gives only pedantic warning), and
+ it occurs in the wild. */
+enum efoo;
+struct Sforward_use {
+ int (*fmember) (enum efoo x);
+};
+
+extern enum efoo it_real_fn(void);
+enum efoo {
+ ONE,
+ TWO,
+};
+struct S2 {
+ enum efoo (*f2) (void);
+};
+void should_compile(struct S2 *s)
+{
+ s->f2 = it_real_fn;
+}
+
+enum efoo it_real_fn(void)
+{
+ return TWO;
+}
+
+static unsigned int deref_uintptr(unsigned int *p)
+{
+ return *p;
+}
+
+enum Epositive {
+ epos_one, epos_two
+};
+
+int main()
+{
+ enum fred frod;
+ enum Epositive epos = epos_two;
+
+ printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
+ /* printf("%d\n", frod); */
+ frod = 12;
+ printf("%d\n", frod);
+ frod = e;
+ printf("%d\n", frod);
+
+ /* Following should compile without warning. */
+ printf ("enum to int: %u\n", deref_uintptr(&epos));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/17_enum.expect b/05/tcc-0.9.27/tests/tests2/17_enum.expect
new file mode 100644
index 0000000..d453a61
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/17_enum.expect
@@ -0,0 +1,4 @@
+0 1 2 3 54 73 74 75
+12
+54
+enum to int: 1
diff --git a/05/tcc-0.9.27/tests/tests2/18_include.c b/05/tcc-0.9.27/tests/tests2/18_include.c
new file mode 100644
index 0000000..dbae3aa
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/18_include.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("including\n");
+#include "18_include.h"
+ printf("done\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/18_include.expect b/05/tcc-0.9.27/tests/tests2/18_include.expect
new file mode 100644
index 0000000..58c6d29
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/18_include.expect
@@ -0,0 +1,3 @@
+including
+included
+done
diff --git a/05/tcc-0.9.27/tests/tests2/18_include.h b/05/tcc-0.9.27/tests/tests2/18_include.h
new file mode 100644
index 0000000..dc86080
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/18_include.h
@@ -0,0 +1 @@
+printf("included\n");
diff --git a/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.c b/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.c
new file mode 100644
index 0000000..aff65e5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ int *b;
+ int *c;
+
+ a = 42;
+ b = &a;
+ c = NULL;
+
+ printf("%d\n", *b);
+
+ if (b == NULL)
+ printf("b is NULL\n");
+ else
+ printf("b is not NULL\n");
+
+ if (c == NULL)
+ printf("c is NULL\n");
+ else
+ printf("c is not NULL\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.expect b/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.expect
new file mode 100644
index 0000000..0cf781b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/19_pointer_arithmetic.expect
@@ -0,0 +1,3 @@
+42
+b is not NULL
+c is NULL
diff --git a/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.c b/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.c
new file mode 100644
index 0000000..825f778
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ int b;
+ int *d;
+ int *e;
+ d = &a;
+ e = &b;
+ a = 12;
+ b = 34;
+ printf("%d\n", *d);
+ printf("%d\n", *e);
+ printf("%d\n", d == e);
+ printf("%d\n", d != e);
+ d = e;
+ printf("%d\n", d == e);
+ printf("%d\n", d != e);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.expect b/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.expect
new file mode 100644
index 0000000..5d1e5f5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/20_pointer_comparison.expect
@@ -0,0 +1,6 @@
+12
+34
+0
+1
+1
+0
diff --git a/05/tcc-0.9.27/tests/tests2/21_char_array.c b/05/tcc-0.9.27/tests/tests2/21_char_array.c
new file mode 100644
index 0000000..f22f527
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/21_char_array.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+int main()
+{
+ int x = 'a';
+ char y = x;
+
+ char *a = "hello";
+
+ printf("%s\n", a);
+
+ int c;
+ c = *a;
+
+ char *b;
+ for (b = a; *b != 0; b++)
+ printf("%c: %d\n", *b, *b);
+
+ char destarray[10];
+ char *dest = &destarray[0];
+ char *src = a;
+
+ while (*src != 0)
+ *dest++ = *src++;
+
+ *dest = 0;
+
+ printf("copied string is %s\n", destarray);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/21_char_array.expect b/05/tcc-0.9.27/tests/tests2/21_char_array.expect
new file mode 100644
index 0000000..dbc6068
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/21_char_array.expect
@@ -0,0 +1,7 @@
+hello
+h: 104
+e: 101
+l: 108
+l: 108
+o: 111
+copied string is hello
diff --git a/05/tcc-0.9.27/tests/tests2/22_floating_point.c b/05/tcc-0.9.27/tests/tests2/22_floating_point.c
new file mode 100644
index 0000000..e3491f5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/22_floating_point.c
@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+ // variables
+ float a = 12.34 + 56.78;
+ printf("%f\n", a);
+
+ // infix operators
+ printf("%f\n", 12.34 + 56.78);
+ printf("%f\n", 12.34 - 56.78);
+ printf("%f\n", 12.34 * 56.78);
+ printf("%f\n", 12.34 / 56.78);
+
+ // comparison operators
+ printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78);
+ printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34);
+ printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34);
+
+ // assignment operators
+ a = 12.34;
+ a += 56.78;
+ printf("%f\n", a);
+
+ a = 12.34;
+ a -= 56.78;
+ printf("%f\n", a);
+
+ a = 12.34;
+ a *= 56.78;
+ printf("%f\n", a);
+
+ a = 12.34;
+ a /= 56.78;
+ printf("%f\n", a);
+
+ // prefix operators
+ printf("%f\n", +12.34);
+ printf("%f\n", -12.34);
+
+ // type coercion
+ a = 2;
+ printf("%f\n", a);
+ printf("%f\n", sin(2));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/22_floating_point.expect b/05/tcc-0.9.27/tests/tests2/22_floating_point.expect
new file mode 100644
index 0000000..75ea3a7
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/22_floating_point.expect
@@ -0,0 +1,16 @@
+69.120003
+69.120000
+-44.440000
+700.665200
+0.217330
+1 1 0 0 0 1
+0 1 1 1 0 0
+0 0 0 1 1 1
+69.120003
+-44.439999
+700.665222
+0.217330
+12.340000
+-12.340000
+2.000000
+0.909297
diff --git a/05/tcc-0.9.27/tests/tests2/23_type_coercion.c b/05/tcc-0.9.27/tests/tests2/23_type_coercion.c
new file mode 100644
index 0000000..1fcc335
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/23_type_coercion.c
@@ -0,0 +1,54 @@
+#include <stdio.h>
+
+void charfunc(char a)
+{
+ printf("char: %c\n", a);
+}
+
+void intfunc(int a)
+{
+ printf("int: %d\n", a);
+}
+
+void floatfunc(float a)
+{
+ printf("float: %f\n", a);
+}
+
+int main()
+{
+ charfunc('a');
+ charfunc(98);
+ charfunc(99.0);
+
+ intfunc('a');
+ intfunc(98);
+ intfunc(99.0);
+
+ floatfunc('a');
+ floatfunc(98);
+ floatfunc(99.0);
+
+ /* printf("%c %d %f\n", 'a', 'b', 'c'); */
+ /* printf("%c %d %f\n", 97, 98, 99); */
+ /* printf("%c %d %f\n", 97.0, 98.0, 99.0); */
+
+ char b = 97;
+ char c = 97.0;
+
+ printf("%d %d\n", b, c);
+
+ int d = 'a';
+ int e = 97.0;
+
+ printf("%d %d\n", d, e);
+
+ float f = 'a';
+ float g = 97;
+
+ printf("%f %f\n", f, g);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/23_type_coercion.expect b/05/tcc-0.9.27/tests/tests2/23_type_coercion.expect
new file mode 100644
index 0000000..d9076f0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/23_type_coercion.expect
@@ -0,0 +1,12 @@
+char: a
+char: b
+char: c
+int: 97
+int: 98
+int: 99
+float: 97.000000
+float: 98.000000
+float: 99.000000
+97 97
+97 97
+97.000000 97.000000
diff --git a/05/tcc-0.9.27/tests/tests2/24_math_library.c b/05/tcc-0.9.27/tests/tests2/24_math_library.c
new file mode 100644
index 0000000..514a25f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/24_math_library.c
@@ -0,0 +1,30 @@
+#define _ISOC99_SOURCE 1
+
+#include <stdio.h>
+#include <math.h>
+
+int main()
+{
+ printf("%f\n", sin(0.12));
+ printf("%f\n", cos(0.12));
+ printf("%f\n", tan(0.12));
+ printf("%f\n", asin(0.12));
+ printf("%f\n", acos(0.12));
+ printf("%f\n", atan(0.12));
+ printf("%f\n", sinh(0.12));
+ printf("%f\n", cosh(0.12));
+ printf("%f\n", tanh(0.12));
+ printf("%f\n", exp(0.12));
+ printf("%f\n", fabs(-0.12));
+ printf("%f\n", log(0.12));
+ printf("%f\n", log10(0.12));
+ printf("%f\n", pow(0.12, 0.12));
+ printf("%f\n", sqrt(0.12));
+ printf("%f\n", round(12.34));
+ printf("%f\n", ceil(12.34));
+ printf("%f\n", floor(12.34));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/24_math_library.expect b/05/tcc-0.9.27/tests/tests2/24_math_library.expect
new file mode 100644
index 0000000..99f7299
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/24_math_library.expect
@@ -0,0 +1,18 @@
+0.119712
+0.992809
+0.120579
+0.120290
+1.450506
+0.119429
+0.120288
+1.007209
+0.119427
+1.127497
+0.120000
+-2.120264
+-0.920819
+0.775357
+0.346410
+12.000000
+13.000000
+12.000000
diff --git a/05/tcc-0.9.27/tests/tests2/25_quicksort.c b/05/tcc-0.9.27/tests/tests2/25_quicksort.c
new file mode 100644
index 0000000..5cc08bd
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/25_quicksort.c
@@ -0,0 +1,83 @@
+#include <stdio.h>
+
+int array[16];
+
+//Swap integer values by array indexes
+void swap(int a, int b)
+{
+ int tmp = array[a];
+ array[a] = array[b];
+ array[b] = tmp;
+}
+
+//Partition the array into two halves and return the
+//index about which the array is partitioned
+int partition(int left, int right)
+{
+ int pivotIndex = left;
+ int pivotValue = array[pivotIndex];
+ int index = left;
+ int i;
+
+ swap(pivotIndex, right);
+ for(i = left; i < right; i++)
+ {
+ if(array[i] < pivotValue)
+ {
+ swap(i, index);
+ index += 1;
+ }
+ }
+ swap(right, index);
+
+ return index;
+}
+
+//Quicksort the array
+void quicksort(int left, int right)
+{
+ if(left >= right)
+ return;
+
+ int index = partition(left, right);
+ quicksort(left, index - 1);
+ quicksort(index + 1, right);
+}
+
+int main()
+{
+ int i;
+
+ array[0] = 62;
+ array[1] = 83;
+ array[2] = 4;
+ array[3] = 89;
+ array[4] = 36;
+ array[5] = 21;
+ array[6] = 74;
+ array[7] = 37;
+ array[8] = 65;
+ array[9] = 33;
+ array[10] = 96;
+ array[11] = 38;
+ array[12] = 53;
+ array[13] = 16;
+ array[14] = 74;
+ array[15] = 55;
+
+ for (i = 0; i < 16; i++)
+ printf("%d ", array[i]);
+
+ printf("\n");
+
+ quicksort(0, 15);
+
+ for (i = 0; i < 16; i++)
+ printf("%d ", array[i]);
+
+ printf("\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/25_quicksort.expect b/05/tcc-0.9.27/tests/tests2/25_quicksort.expect
new file mode 100644
index 0000000..2d39cd3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/25_quicksort.expect
@@ -0,0 +1,2 @@
+62 83 4 89 36 21 74 37 65 33 96 38 53 16 74 55
+4 16 21 33 36 37 38 53 55 62 65 74 74 83 89 96
diff --git a/05/tcc-0.9.27/tests/tests2/26_character_constants.c b/05/tcc-0.9.27/tests/tests2/26_character_constants.c
new file mode 100644
index 0000000..95c4423
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/26_character_constants.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("%d\n", '\1');
+ printf("%d\n", '\10');
+ printf("%d\n", '\100');
+ printf("%d\n", '\x01');
+ printf("%d\n", '\x0e');
+ printf("%d\n", '\x10');
+ printf("%d\n", '\x40');
+ printf("test \x40\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/26_character_constants.expect b/05/tcc-0.9.27/tests/tests2/26_character_constants.expect
new file mode 100644
index 0000000..8f8bfa4
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/26_character_constants.expect
@@ -0,0 +1,8 @@
+1
+8
+64
+1
+14
+16
+64
+test @
diff --git a/05/tcc-0.9.27/tests/tests2/27_sizeof.c b/05/tcc-0.9.27/tests/tests2/27_sizeof.c
new file mode 100644
index 0000000..5ae0ede
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/27_sizeof.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+ char a;
+ int b;
+ double c;
+
+ printf("%d\n", sizeof(a));
+ printf("%d\n", sizeof(b));
+ printf("%d\n", sizeof(c));
+
+ printf("%d\n", sizeof(!a));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/27_sizeof.expect b/05/tcc-0.9.27/tests/tests2/27_sizeof.expect
new file mode 100644
index 0000000..a47ea3a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/27_sizeof.expect
@@ -0,0 +1,4 @@
+1
+4
+8
+4
diff --git a/05/tcc-0.9.27/tests/tests2/28_strings.c b/05/tcc-0.9.27/tests/tests2/28_strings.c
new file mode 100644
index 0000000..2db2298
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/28_strings.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ char a[10];
+
+ strcpy(a, "hello");
+ printf("%s\n", a);
+
+ strncpy(a, "gosh", 2);
+ printf("%s\n", a);
+
+ printf("%d\n", strcmp(a, "apple") > 0);
+ printf("%d\n", strcmp(a, "goere") > 0);
+ printf("%d\n", strcmp(a, "zebra") < 0);
+
+ printf("%d\n", strlen(a));
+
+ strcat(a, "!");
+ printf("%s\n", a);
+
+ printf("%d\n", strncmp(a, "apple", 2) > 0);
+ printf("%d\n", strncmp(a, "goere", 2) == 0);
+ printf("%d\n", strncmp(a, "goerg", 2) == 0);
+ printf("%d\n", strncmp(a, "zebra", 2) < 0);
+
+ printf("%s\n", strchr(a, 'o'));
+ printf("%s\n", strrchr(a, 'l'));
+ printf("%d\n", strrchr(a, 'x') == NULL);
+
+ memset(&a[1], 'r', 4);
+ printf("%s\n", a);
+
+ memcpy(&a[2], a, 2);
+ printf("%s\n", a);
+
+ printf("%d\n", memcmp(a, "apple", 4) > 0);
+ printf("%d\n", memcmp(a, "grgr", 4) == 0);
+ printf("%d\n", memcmp(a, "zebra", 4) < 0);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/28_strings.expect b/05/tcc-0.9.27/tests/tests2/28_strings.expect
new file mode 100644
index 0000000..fd9217a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/28_strings.expect
@@ -0,0 +1,19 @@
+hello
+gollo
+1
+1
+1
+5
+gollo!
+1
+1
+1
+1
+ollo!
+lo!
+1
+grrrr!
+grgrr!
+1
+1
+1
diff --git a/05/tcc-0.9.27/tests/tests2/29_array_address.c b/05/tcc-0.9.27/tests/tests2/29_array_address.c
new file mode 100644
index 0000000..bda5ddd
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/29_array_address.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ char a[10];
+ strcpy(a, "abcdef");
+ printf("%s\n", &a[1]);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/29_array_address.expect b/05/tcc-0.9.27/tests/tests2/29_array_address.expect
new file mode 100644
index 0000000..9bc8683
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/29_array_address.expect
@@ -0,0 +1 @@
+bcdef
diff --git a/05/tcc-0.9.27/tests/tests2/30_hanoi.c b/05/tcc-0.9.27/tests/tests2/30_hanoi.c
new file mode 100644
index 0000000..7c0893b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/30_hanoi.c
@@ -0,0 +1,122 @@
+/* example from http://barnyard.syr.edu/quickies/hanoi.c */
+
+/* hanoi.c: solves the tower of hanoi problem. (Programming exercise.) */
+/* By Terry R. McConnell (12/2/97) */
+/* Compile: cc -o hanoi hanoi.c */
+
+/* This program does no error checking. But then, if it's right,
+ it's right ... right ? */
+
+
+/* The original towers of hanoi problem seems to have been originally posed
+ by one M. Claus in 1883. There is a popular legend that goes along with
+ it that has been often repeated and paraphrased. It goes something like this:
+ In the great temple at Benares there are 3 golden spikes. On one of them,
+ God placed 64 disks increasing in size from bottom to top, at the beginning
+ of time. Since then, and to this day, the priest on duty constantly transfers
+ disks, one at a time, in such a way that no larger disk is ever put on top
+ of a smaller one. When the disks have been transferred entirely to another
+ spike the Universe will come to an end in a large thunderclap.
+
+ This paraphrases the original legend due to DeParville, La Nature, Paris 1884,
+ Part I, 285-286. For this and further information see: Mathematical
+ Recreations & Essays, W.W. Rouse Ball, MacMillan, NewYork, 11th Ed. 1967,
+ 303-305.
+ *
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TRUE 1
+#define FALSE 0
+
+/* This is the number of "disks" on tower A initially. Taken to be 64 in the
+ * legend. The number of moves required, in general, is 2^N - 1. For N = 64,
+ * this is 18,446,744,073,709,551,615 */
+#define N 4
+
+/* These are the three towers. For example if the state of A is 0,1,3,4, that
+ * means that there are three discs on A of sizes 1, 3, and 4. (Think of right
+ * as being the "down" direction.) */
+int A[N], B[N], C[N];
+
+void Hanoi(int,int*,int*,int*);
+
+/* Print the current configuration of A, B, and C to the screen */
+void PrintAll()
+{
+ int i;
+
+ printf("A: ");
+ for(i=0;i<N;i++)printf(" %d ",A[i]);
+ printf("\n");
+
+ printf("B: ");
+ for(i=0;i<N;i++)printf(" %d ",B[i]);
+ printf("\n");
+
+ printf("C: ");
+ for(i=0;i<N;i++)printf(" %d ",C[i]);
+ printf("\n");
+ printf("------------------------------------------\n");
+ return;
+}
+
+/* Move the leftmost nonzero element of source to dest, leave behind 0. */
+/* Returns the value moved (not used.) */
+int Move(int *source, int *dest)
+{
+ int i = 0, j = 0;
+
+ while (i<N && (source[i])==0) i++;
+ while (j<N && (dest[j])==0) j++;
+
+ dest[j-1] = source[i];
+ source[i] = 0;
+ PrintAll(); /* Print configuration after each move. */
+ return dest[j-1];
+}
+
+
+/* Moves first n nonzero numbers from source to dest using the rules of Hanoi.
+ Calls itself recursively.
+ */
+void Hanoi(int n,int *source, int *dest, int *spare)
+{
+ int i;
+ if(n==1){
+ Move(source,dest);
+ return;
+ }
+
+ Hanoi(n-1,source,spare,dest);
+ Move(source,dest);
+ Hanoi(n-1,spare,dest,source);
+ return;
+}
+
+int main()
+{
+ int i;
+
+ /* initialize the towers */
+ for(i=0;i<N;i++)A[i]=i+1;
+ for(i=0;i<N;i++)B[i]=0;
+ for(i=0;i<N;i++)C[i]=0;
+
+ printf("Solution of Tower of Hanoi Problem with %d Disks\n\n",N);
+
+ /* Print the starting state */
+ printf("Starting state:\n");
+ PrintAll();
+ printf("\n\nSubsequent states:\n\n");
+
+ /* Do it! Use A = Source, B = Destination, C = Spare */
+ Hanoi(N,A,B,C);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/30_hanoi.expect b/05/tcc-0.9.27/tests/tests2/30_hanoi.expect
new file mode 100644
index 0000000..7798ee0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/30_hanoi.expect
@@ -0,0 +1,71 @@
+Solution of Tower of Hanoi Problem with 4 Disks
+
+Starting state:
+A: 1 2 3 4
+B: 0 0 0 0
+C: 0 0 0 0
+------------------------------------------
+
+
+Subsequent states:
+
+A: 0 2 3 4
+B: 0 0 0 0
+C: 0 0 0 1
+------------------------------------------
+A: 0 0 3 4
+B: 0 0 0 2
+C: 0 0 0 1
+------------------------------------------
+A: 0 0 3 4
+B: 0 0 1 2
+C: 0 0 0 0
+------------------------------------------
+A: 0 0 0 4
+B: 0 0 1 2
+C: 0 0 0 3
+------------------------------------------
+A: 0 0 1 4
+B: 0 0 0 2
+C: 0 0 0 3
+------------------------------------------
+A: 0 0 1 4
+B: 0 0 0 0
+C: 0 0 2 3
+------------------------------------------
+A: 0 0 0 4
+B: 0 0 0 0
+C: 0 1 2 3
+------------------------------------------
+A: 0 0 0 0
+B: 0 0 0 4
+C: 0 1 2 3
+------------------------------------------
+A: 0 0 0 0
+B: 0 0 1 4
+C: 0 0 2 3
+------------------------------------------
+A: 0 0 0 2
+B: 0 0 1 4
+C: 0 0 0 3
+------------------------------------------
+A: 0 0 1 2
+B: 0 0 0 4
+C: 0 0 0 3
+------------------------------------------
+A: 0 0 1 2
+B: 0 0 3 4
+C: 0 0 0 0
+------------------------------------------
+A: 0 0 0 2
+B: 0 0 3 4
+C: 0 0 0 1
+------------------------------------------
+A: 0 0 0 0
+B: 0 2 3 4
+C: 0 0 0 1
+------------------------------------------
+A: 0 0 0 0
+B: 1 2 3 4
+C: 0 0 0 0
+------------------------------------------
diff --git a/05/tcc-0.9.27/tests/tests2/31_args.c b/05/tcc-0.9.27/tests/tests2/31_args.c
new file mode 100644
index 0000000..dcafed5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/31_args.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ int Count;
+
+ printf("hello world %d\n", argc);
+ for (Count = 1; Count < argc; Count++)
+ printf("arg %d: %s\n", Count, argv[Count]);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/31_args.expect b/05/tcc-0.9.27/tests/tests2/31_args.expect
new file mode 100644
index 0000000..8c60bfc
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/31_args.expect
@@ -0,0 +1,6 @@
+hello world 6
+arg 1: arg1
+arg 2: arg2
+arg 3: arg3
+arg 4: arg4
+arg 5: arg5
diff --git a/05/tcc-0.9.27/tests/tests2/32_led.c b/05/tcc-0.9.27/tests/tests2/32_led.c
new file mode 100644
index 0000000..5596cbf
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/32_led.c
@@ -0,0 +1,266 @@
+/* example from http://barnyard.syr.edu/quickies/led.c */
+
+/* led.c: print out number as if on 7 line led display. I.e., write integer
+ given on command line like this:
+ _ _ _
+ | _| _| |_| |_
+ | |_ _| | _| etc.
+
+ We assume the terminal behaves like a classical teletype. So the top
+ lines of all digits have to be printed first, then the middle lines of
+ all digits, etc.
+
+ By Terry R. McConnell
+
+compile: cc -o led led.c
+
+If you just want to link in the subroutine print_led that does all the
+work, compile with -DNO_MAIN, and declare the following in any source file
+that uses the call:
+
+extern void print_led(unsigned long x, char *buf);
+
+Bug: you cannot call repeatedly to print more than one number to a line.
+That would require curses or some other terminal API that allows moving the
+cursor to a previous line.
+
+*/
+
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define MAX_DIGITS 32
+#define NO_MAIN
+
+
+/* Print the top line of the digit d into buffer.
+ Does not null terminate buffer. */
+
+void topline(int d, char *p){
+
+ *p++ = ' ';
+ switch(d){
+
+ /* all these have _ on top line */
+
+ case 0:
+ case 2:
+ case 3:
+ case 5:
+ case 7:
+ case 8:
+ case 9:
+ *p++ = '_';
+ break;
+ default:
+ *p++=' ';
+
+ }
+ *p++=' ';
+}
+
+/* Print the middle line of the digit d into the buffer.
+ Does not null terminate. */
+
+void midline(int d, char *p){
+
+ switch(d){
+
+ /* those that have leading | on middle line */
+
+ case 0:
+ case 4:
+ case 5:
+ case 6:
+ case 8:
+ case 9:
+ *p++='|';
+ break;
+ default:
+ *p++=' ';
+ }
+ switch(d){
+
+ /* those that have _ on middle line */
+
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 8:
+ case 9:
+ *p++='_';
+ break;
+ default:
+ *p++=' ';
+
+ }
+ switch(d){
+
+ /* those that have closing | on middle line */
+
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 7:
+ case 8:
+ case 9:
+ *p++='|';
+ break;
+ default:
+ *p++=' ';
+
+ }
+}
+
+/* Print the bottom line of the digit d. Does not null terminate. */
+
+void botline(int d, char *p){
+
+
+ switch(d){
+
+ /* those that have leading | on bottom line */
+
+ case 0:
+ case 2:
+ case 6:
+ case 8:
+ *p++='|';
+ break;
+ default:
+ *p++=' ';
+ }
+ switch(d){
+
+ /* those that have _ on bottom line */
+
+ case 0:
+ case 2:
+ case 3:
+ case 5:
+ case 6:
+ case 8:
+ *p++='_';
+ break;
+ default:
+ *p++=' ';
+
+ }
+ switch(d){
+
+ /* those that have closing | on bottom line */
+
+ case 0:
+ case 1:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ *p++='|';
+ break;
+ default:
+ *p++=' ';
+
+ }
+}
+
+/* Write the led representation of integer to string buffer. */
+
+void print_led(unsigned long x, char *buf)
+{
+
+ int i=0,n;
+ static int d[MAX_DIGITS];
+
+
+ /* extract digits from x */
+
+ n = ( x == 0L ? 1 : 0 ); /* 0 is a digit, hence a special case */
+
+ while(x){
+ d[n++] = (int)(x%10L);
+ if(n >= MAX_DIGITS)break;
+ x = x/10L;
+ }
+
+ /* print top lines of all digits */
+
+ for(i=n-1;i>=0;i--){
+ topline(d[i],buf);
+ buf += 3;
+ *buf++=' ';
+ }
+ *buf++='\n'; /* move teletype to next line */
+
+ /* print middle lines of all digits */
+
+ for(i=n-1;i>=0;i--){
+ midline(d[i],buf);
+ buf += 3;
+ *buf++=' ';
+ }
+ *buf++='\n';
+
+ /* print bottom lines of all digits */
+
+ for(i=n-1;i>=0;i--){
+ botline(d[i],buf);
+ buf += 3;
+ *buf++=' ';
+ }
+ *buf++='\n';
+ *buf='\0';
+}
+
+int main()
+{
+ char buf[5*MAX_DIGITS];
+ print_led(1234567, buf);
+ printf("%s\n",buf);
+
+ return 0;
+}
+
+#ifndef NO_MAIN
+int main(int argc, char **argv)
+{
+
+ int i=0,n;
+ long x;
+ static int d[MAX_DIGITS];
+ char buf[5*MAX_DIGITS];
+
+ if(argc != 2){
+ fprintf(stderr,"led: usage: led integer\n");
+ return 1;
+ }
+
+ /* fetch argument from command line */
+
+ x = atol(argv[1]);
+
+ /* sanity check */
+
+ if(x<0){
+ fprintf(stderr,"led: %d must be non-negative\n",x);
+ return 1;
+ }
+
+ print_led(x,buf);
+ printf("%s\n",buf);
+
+ return 0;
+
+}
+#endif
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/32_led.expect b/05/tcc-0.9.27/tests/tests2/32_led.expect
new file mode 100644
index 0000000..c53b58a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/32_led.expect
@@ -0,0 +1,4 @@
+ _ _ _ _
+ | _| _| |_| |_ |_ |
+ | |_ _| | _| |_| |
+
diff --git a/05/tcc-0.9.27/tests/tests2/33_ternary_op.c b/05/tcc-0.9.27/tests/tests2/33_ternary_op.c
new file mode 100644
index 0000000..8579b50
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/33_ternary_op.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count;
+
+ for (Count = 0; Count < 10; Count++)
+ {
+ printf("%d\n", (Count < 5) ? (Count*Count) : (Count * 3));
+ }
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/33_ternary_op.expect b/05/tcc-0.9.27/tests/tests2/33_ternary_op.expect
new file mode 100644
index 0000000..45ea507
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/33_ternary_op.expect
@@ -0,0 +1,10 @@
+0
+1
+4
+9
+16
+15
+18
+21
+24
+27
diff --git a/05/tcc-0.9.27/tests/tests2/34_array_assignment.c b/05/tcc-0.9.27/tests/tests2/34_array_assignment.c
new file mode 100644
index 0000000..5885c97
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/34_array_assignment.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+int main()
+{
+ int a[4];
+
+ a[0] = 12;
+ a[1] = 23;
+ a[2] = 34;
+ a[3] = 45;
+
+ printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]);
+
+ int b[4];
+
+ b = a;
+
+ printf("%d %d %d %d\n", b[0], b[1], b[2], b[3]);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/34_array_assignment.expect b/05/tcc-0.9.27/tests/tests2/34_array_assignment.expect
new file mode 100644
index 0000000..9736bf5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/34_array_assignment.expect
@@ -0,0 +1,2 @@
+12 23 34 45
+12 23 34 45
diff --git a/05/tcc-0.9.27/tests/tests2/35_sizeof.c b/05/tcc-0.9.27/tests/tests2/35_sizeof.c
new file mode 100644
index 0000000..672e87e
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/35_sizeof.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int main()
+{
+ char a;
+ short b;
+
+ printf("%d %d\n", sizeof(char), sizeof(a));
+ printf("%d %d\n", sizeof(short), sizeof(b));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/35_sizeof.expect b/05/tcc-0.9.27/tests/tests2/35_sizeof.expect
new file mode 100644
index 0000000..534fb83
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/35_sizeof.expect
@@ -0,0 +1,2 @@
+1 1
+2 2
diff --git a/05/tcc-0.9.27/tests/tests2/36_array_initialisers.c b/05/tcc-0.9.27/tests/tests2/36_array_initialisers.c
new file mode 100644
index 0000000..1bc8ee0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/36_array_initialisers.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count;
+
+ int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };
+
+ for (Count = 0; Count < 10; Count++)
+ printf("%d: %d\n", Count, Array[Count]);
+
+ int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, };
+
+ for (Count = 0; Count < 10; Count++)
+ printf("%d: %d\n", Count, Array2[Count]);
+
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/36_array_initialisers.expect b/05/tcc-0.9.27/tests/tests2/36_array_initialisers.expect
new file mode 100644
index 0000000..3ac6c77
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/36_array_initialisers.expect
@@ -0,0 +1,20 @@
+0: 12
+1: 34
+2: 56
+3: 78
+4: 90
+5: 123
+6: 456
+7: 789
+8: 8642
+9: 9753
+0: 12
+1: 34
+2: 56
+3: 78
+4: 90
+5: 123
+6: 456
+7: 789
+8: 8642
+9: 9753
diff --git a/05/tcc-0.9.27/tests/tests2/37_sprintf.c b/05/tcc-0.9.27/tests/tests2/37_sprintf.c
new file mode 100644
index 0000000..1dd1dce
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/37_sprintf.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main()
+{
+ char Buf[100];
+ int Count;
+
+ for (Count = 1; Count <= 20; Count++)
+ {
+ sprintf(Buf, "->%02d<-\n", Count);
+ printf("%s", Buf);
+ }
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/37_sprintf.expect b/05/tcc-0.9.27/tests/tests2/37_sprintf.expect
new file mode 100644
index 0000000..a643da8
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/37_sprintf.expect
@@ -0,0 +1,20 @@
+->01<-
+->02<-
+->03<-
+->04<-
+->05<-
+->06<-
+->07<-
+->08<-
+->09<-
+->10<-
+->11<-
+->12<-
+->13<-
+->14<-
+->15<-
+->16<-
+->17<-
+->18<-
+->19<-
+->20<-
diff --git a/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.c b/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.c
new file mode 100644
index 0000000..4e1868e
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+
+int main()
+{
+ int a[4][4];
+ int b = 0;
+ int x;
+ int y;
+
+ for (x = 0; x < 4; x++)
+ {
+ for (y = 0; y < 4; y++)
+ {
+ b++;
+ a[x][y] = b;
+ }
+ }
+
+ for (x = 0; x < 4; x++)
+ {
+ printf("x=%d: ", x);
+ for (y = 0; y < 4; y++)
+ {
+ printf("%d ", a[x][y]);
+ }
+ printf("\n");
+ }
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.expect b/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.expect
new file mode 100644
index 0000000..747ad75
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/38_multiple_array_index.expect
@@ -0,0 +1,4 @@
+x=0: 1 2 3 4
+x=1: 5 6 7 8
+x=2: 9 10 11 12
+x=3: 13 14 15 16
diff --git a/05/tcc-0.9.27/tests/tests2/39_typedef.c b/05/tcc-0.9.27/tests/tests2/39_typedef.c
new file mode 100644
index 0000000..da73f71
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/39_typedef.c
@@ -0,0 +1,65 @@
+#include <stdio.h>
+
+typedef int MyInt;
+
+struct FunStruct
+{
+ int i;
+ int j;
+};
+
+typedef struct FunStruct MyFunStruct;
+
+typedef MyFunStruct *MoreFunThanEver;
+
+int main()
+{
+ MyInt a = 1;
+ printf("%d\n", a);
+
+ MyFunStruct b;
+ b.i = 12;
+ b.j = 34;
+ printf("%d,%d\n", b.i, b.j);
+
+ MoreFunThanEver c = &b;
+ printf("%d,%d\n", c->i, c->j);
+
+ return 0;
+}
+
+/* "If the specification of an array type includes any type qualifiers,
+ the element type is so-qualified, not the array type." */
+
+typedef int A[3];
+extern A const ca;
+extern const A ca;
+extern const int ca[3];
+
+typedef A B[1][2];
+extern B const cb;
+extern const B cb;
+extern const int cb[1][2][3];
+
+extern B b;
+extern int b[1][2][3];
+
+/* Funny but valid function declaration. */
+typedef int functype (int);
+extern functype func;
+int func(int i)
+{
+ return i + 1;
+}
+
+/* Even funnier function decl and definition using typeof. */
+int set_anon_super(void);
+int set_anon_super(void)
+{
+ return 42;
+}
+typedef int sas_type (void);
+extern typeof(set_anon_super) set_anon_super;
+extern sas_type set_anon_super;
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/39_typedef.expect b/05/tcc-0.9.27/tests/tests2/39_typedef.expect
new file mode 100644
index 0000000..b9050a9
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/39_typedef.expect
@@ -0,0 +1,3 @@
+1
+12,34
+12,34
diff --git a/05/tcc-0.9.27/tests/tests2/40_stdio.c b/05/tcc-0.9.27/tests/tests2/40_stdio.c
new file mode 100644
index 0000000..b986093
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/40_stdio.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+
+int main()
+{
+ FILE *f = fopen("fred.txt", "w");
+ fwrite("hello\nhello\n", 1, 12, f);
+ fclose(f);
+
+ char freddy[7];
+ f = fopen("fred.txt", "r");
+ if (fread(freddy, 1, 6, f) != 6)
+ printf("couldn't read fred.txt\n");
+
+ freddy[6] = '\0';
+ fclose(f);
+
+ printf("%s", freddy);
+
+ int InChar;
+ char ShowChar;
+ f = fopen("fred.txt", "r");
+ while ( (InChar = fgetc(f)) != EOF)
+ {
+ ShowChar = InChar;
+ if (ShowChar < ' ')
+ ShowChar = '.';
+
+ printf("ch: %d '%c'\n", InChar, ShowChar);
+ }
+ fclose(f);
+
+ f = fopen("fred.txt", "r");
+ while ( (InChar = getc(f)) != EOF)
+ {
+ ShowChar = InChar;
+ if (ShowChar < ' ')
+ ShowChar = '.';
+
+ printf("ch: %d '%c'\n", InChar, ShowChar);
+ }
+ fclose(f);
+
+ f = fopen("fred.txt", "r");
+ while (fgets(freddy, sizeof(freddy), f) != NULL)
+ printf("x: %s", freddy);
+
+ fclose(f);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/40_stdio.expect b/05/tcc-0.9.27/tests/tests2/40_stdio.expect
new file mode 100644
index 0000000..e08167a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/40_stdio.expect
@@ -0,0 +1,27 @@
+hello
+ch: 104 'h'
+ch: 101 'e'
+ch: 108 'l'
+ch: 108 'l'
+ch: 111 'o'
+ch: 10 '.'
+ch: 104 'h'
+ch: 101 'e'
+ch: 108 'l'
+ch: 108 'l'
+ch: 111 'o'
+ch: 10 '.'
+ch: 104 'h'
+ch: 101 'e'
+ch: 108 'l'
+ch: 108 'l'
+ch: 111 'o'
+ch: 10 '.'
+ch: 104 'h'
+ch: 101 'e'
+ch: 108 'l'
+ch: 108 'l'
+ch: 111 'o'
+ch: 10 '.'
+x: hello
+x: hello
diff --git a/05/tcc-0.9.27/tests/tests2/41_hashif.c b/05/tcc-0.9.27/tests/tests2/41_hashif.c
new file mode 100644
index 0000000..cb37b9e
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/41_hashif.c
@@ -0,0 +1,85 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("#include test\n");
+
+#if 1
+#if 0
+ printf("a\n");
+#else
+ printf("b\n");
+#endif
+#else
+#if 0
+ printf("c\n");
+#else
+ printf("d\n");
+#endif
+#endif
+
+#if 0
+#if 1
+ printf("e\n");
+#else
+ printf("f\n");
+#endif
+#else
+#if 1
+ printf("g\n");
+#else
+ printf("h\n");
+#endif
+#endif
+
+#define DEF
+
+#ifdef DEF
+#ifdef DEF
+ printf("i\n");
+#else
+ printf("j\n");
+#endif
+#else
+#ifdef DEF
+ printf("k\n");
+#else
+ printf("l\n");
+#endif
+#endif
+
+#ifndef DEF
+#ifndef DEF
+ printf("m\n");
+#else
+ printf("n\n");
+#endif
+#else
+#ifndef DEF
+ printf("o\n");
+#else
+ printf("p\n");
+#endif
+#endif
+
+#define ONE 1
+#define ZERO 0
+
+#if ONE
+#if ZERO
+ printf("q\n");
+#else
+ printf("r\n");
+#endif
+#else
+#if ZERO
+ printf("s\n");
+#else
+ printf("t\n");
+#endif
+#endif
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/41_hashif.expect b/05/tcc-0.9.27/tests/tests2/41_hashif.expect
new file mode 100644
index 0000000..5fd414b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/41_hashif.expect
@@ -0,0 +1,6 @@
+#include test
+b
+g
+i
+p
+r
diff --git a/05/tcc-0.9.27/tests/tests2/42_function_pointer.c b/05/tcc-0.9.27/tests/tests2/42_function_pointer.c
new file mode 100644
index 0000000..697bd79
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/42_function_pointer.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+
+int fred(int p)
+{
+ printf("yo %d\n", p);
+ return 42;
+}
+
+int (*f)(int) = &fred;
+
+/* To test what this is supposed to test the destination function
+ (fprint here) must not be called directly anywhere in the test. */
+int (*fprintfptr)(FILE *, const char *, ...) = &fprintf;
+
+int main()
+{
+ fprintfptr(stdout, "%d\n", (*f)(24));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/42_function_pointer.expect b/05/tcc-0.9.27/tests/tests2/42_function_pointer.expect
new file mode 100644
index 0000000..6c8b6ce
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/42_function_pointer.expect
@@ -0,0 +1,2 @@
+yo 24
+42
diff --git a/05/tcc-0.9.27/tests/tests2/43_void_param.c b/05/tcc-0.9.27/tests/tests2/43_void_param.c
new file mode 100644
index 0000000..de17098
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/43_void_param.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+void fred(void)
+{
+ printf("yo\n");
+}
+
+int main()
+{
+ fred();
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/43_void_param.expect b/05/tcc-0.9.27/tests/tests2/43_void_param.expect
new file mode 100644
index 0000000..092bfb9
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/43_void_param.expect
@@ -0,0 +1 @@
+yo
diff --git a/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.c b/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.c
new file mode 100644
index 0000000..f38664f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+
+ for (a = 0; a < 2; a++)
+ {
+ int b = a;
+ }
+
+ printf("it's all good\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.expect b/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.expect
new file mode 100644
index 0000000..231ccc0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/44_scoped_declarations.expect
@@ -0,0 +1 @@
+it's all good
diff --git a/05/tcc-0.9.27/tests/tests2/45_empty_for.c b/05/tcc-0.9.27/tests/tests2/45_empty_for.c
new file mode 100644
index 0000000..7cef513
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/45_empty_for.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+int main()
+{
+ int Count = 0;
+
+ for (;;)
+ {
+ Count++;
+ printf("%d\n", Count);
+ if (Count >= 10)
+ break;
+ }
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/45_empty_for.expect b/05/tcc-0.9.27/tests/tests2/45_empty_for.expect
new file mode 100644
index 0000000..f00c965
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/45_empty_for.expect
@@ -0,0 +1,10 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
diff --git a/05/tcc-0.9.27/tests/tests2/46_grep.c b/05/tcc-0.9.27/tests/tests2/46_grep.c
new file mode 100644
index 0000000..049dfb1
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/46_grep.c
@@ -0,0 +1,568 @@
+/*
+ * The information in this document is subject to change
+ * without notice and should not be construed as a commitment
+ * by Digital Equipment Corporation or by DECUS.
+ *
+ * Neither Digital Equipment Corporation, DECUS, nor the authors
+ * assume any responsibility for the use or reliability of this
+ * document or the described software.
+ *
+ * Copyright (C) 1980, DECUS
+ *
+ * General permission to copy or modify, but not for profit, is
+ * hereby granted, provided that the above copyright notice is
+ * included and reference made to the fact that reproduction
+ * privileges were granted by DECUS.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h> // tolower()
+
+/*
+ * grep
+ *
+ * Runs on the Decus compiler or on vms, On vms, define as:
+ * grep :== "$disk:[account]grep" (native)
+ * grep :== "$disk:[account]grep grep" (Decus)
+ * See below for more information.
+ */
+
+char *documentation[] = {
+ "grep searches a file for a given pattern. Execute by",
+ " grep [flags] regular_expression file_list\n",
+ "Flags are single characters preceded by '-':",
+ " -c Only a count of matching lines is printed",
+ " -f Print file name for matching lines switch, see below",
+ " -n Each line is preceded by its line number",
+ " -v Only print non-matching lines\n",
+ "The file_list is a list of files (wildcards are acceptable on RSX modes).",
+ "\nThe file name is normally printed if there is a file given.",
+ "The -f flag reverses this action (print name no file, not if more).\n",
+ 0 };
+
+char *patdoc[] = {
+ "The regular_expression defines the pattern to search for. Upper- and",
+ "lower-case are always ignored. Blank lines never match. The expression",
+ "should be quoted to prevent file-name translation.",
+ "x An ordinary character (not mentioned below) matches that character.",
+ "'\\' The backslash quotes any character. \"\\$\" matches a dollar-sign.",
+ "'^' A circumflex at the beginning of an expression matches the",
+ " beginning of a line.",
+ "'$' A dollar-sign at the end of an expression matches the end of a line.",
+ "'.' A period matches any character except \"new-line\".",
+ "':a' A colon matches a class of characters described by the following",
+ "':d' character. \":a\" matches any alphabetic, \":d\" matches digits,",
+ "':n' \":n\" matches alphanumerics, \": \" matches spaces, tabs, and",
+ "': ' other control characters, such as new-line.",
+ "'*' An expression followed by an asterisk matches zero or more",
+ " occurrences of that expression: \"fo*\" matches \"f\", \"fo\"",
+ " \"foo\", etc.",
+ "'+' An expression followed by a plus sign matches one or more",
+ " occurrences of that expression: \"fo+\" matches \"fo\", etc.",
+ "'-' An expression followed by a minus sign optionally matches",
+ " the expression.",
+ "'[]' A string enclosed in square brackets matches any character in",
+ " that string, but no others. If the first character in the",
+ " string is a circumflex, the expression matches any character",
+ " except \"new-line\" and the characters in the string. For",
+ " example, \"[xyz]\" matches \"xx\" and \"zyx\", while \"[^xyz]\"",
+ " matches \"abc\" but not \"axb\". A range of characters may be",
+ " specified by two characters separated by \"-\". Note that,",
+ " [a-z] matches alphabetics, while [z-a] never matches.",
+ "The concatenation of regular expressions is a regular expression.",
+ 0};
+
+#define LMAX 512
+#define PMAX 256
+
+#define CHAR 1
+#define BOL 2
+#define EOL 3
+#define ANY 4
+#define CLASS 5
+#define NCLASS 6
+#define STAR 7
+#define PLUS 8
+#define MINUS 9
+#define ALPHA 10
+#define DIGIT 11
+#define NALPHA 12
+#define PUNCT 13
+#define RANGE 14
+#define ENDPAT 15
+
+int cflag=0, fflag=0, nflag=0, vflag=0, nfile=0, debug=0;
+
+char *pp, lbuf[LMAX], pbuf[PMAX];
+
+char *cclass();
+char *pmatch();
+void store(int);
+void error(char *);
+void badpat(char *, char *, char *);
+int match(void);
+
+
+/*** Display a file name *******************************/
+void file(char *s)
+{
+ printf("File %s:\n", s);
+}
+
+/*** Report unopenable file ****************************/
+void cant(char *s)
+{
+ fprintf(stderr, "%s: cannot open\n", s);
+}
+
+/*** Give good help ************************************/
+void help(char **hp)
+{
+ char **dp;
+
+ for (dp = hp; *dp; ++dp)
+ printf("%s\n", *dp);
+}
+
+/*** Display usage summary *****************************/
+void usage(char *s)
+{
+ fprintf(stderr, "?GREP-E-%s\n", s);
+ fprintf(stderr,
+ "Usage: grep [-cfnv] pattern [file ...]. grep ? for help\n");
+ exit(1);
+}
+
+/*** Compile the pattern into global pbuf[] ************/
+void compile(char *source)
+{
+ char *s; /* Source string pointer */
+ char *lp; /* Last pattern pointer */
+ int c; /* Current character */
+ int o; /* Temp */
+ char *spp; /* Save beginning of pattern */
+
+ s = source;
+ if (debug)
+ printf("Pattern = \"%s\"\n", s);
+ pp = pbuf;
+ while (c = *s++) {
+ /*
+ * STAR, PLUS and MINUS are special.
+ */
+ if (c == '*' || c == '+' || c == '-') {
+ if (pp == pbuf ||
+ (o=pp[-1]) == BOL ||
+ o == EOL ||
+ o == STAR ||
+ o == PLUS ||
+ o == MINUS)
+ badpat("Illegal occurrence op.", source, s);
+ store(ENDPAT);
+ store(ENDPAT);
+ spp = pp; /* Save pattern end */
+ while (--pp > lp) /* Move pattern down */
+ *pp = pp[-1]; /* one byte */
+ *pp = (c == '*') ? STAR :
+ (c == '-') ? MINUS : PLUS;
+ pp = spp; /* Restore pattern end */
+ continue;
+ }
+ /*
+ * All the rest.
+ */
+ lp = pp; /* Remember start */
+ switch(c) {
+
+ case '^':
+ store(BOL);
+ break;
+
+ case '$':
+ store(EOL);
+ break;
+
+ case '.':
+ store(ANY);
+ break;
+
+ case '[':
+ s = cclass(source, s);
+ break;
+
+ case ':':
+ if (*s) {
+ switch(tolower(c = *s++)) {
+
+ case 'a':
+ case 'A':
+ store(ALPHA);
+ break;
+
+ case 'd':
+ case 'D':
+ store(DIGIT);
+ break;
+
+ case 'n':
+ case 'N':
+ store(NALPHA);
+ break;
+
+ case ' ':
+ store(PUNCT);
+ break;
+
+ default:
+ badpat("Unknown : type", source, s);
+
+ }
+ break;
+ }
+ else badpat("No : type", source, s);
+
+ case '\\':
+ if (*s)
+ c = *s++;
+
+ default:
+ store(CHAR);
+ store(tolower(c));
+ }
+ }
+ store(ENDPAT);
+ store(0); /* Terminate string */
+ if (debug) {
+ for (lp = pbuf; lp < pp;) {
+ if ((c = (*lp++ & 0377)) < ' ')
+ printf("\\%o ", c);
+ else printf("%c ", c);
+ }
+ printf("\n");
+ }
+}
+
+/*** Compile a class (within []) ***********************/
+char *cclass(char *source, char *src)
+ /* char *source; // Pattern start -- for error msg. */
+ /* char *src; // Class start */
+{
+ char *s; /* Source pointer */
+ char *cp; /* Pattern start */
+ int c; /* Current character */
+ int o; /* Temp */
+
+ s = src;
+ o = CLASS;
+ if (*s == '^') {
+ ++s;
+ o = NCLASS;
+ }
+ store(o);
+ cp = pp;
+ store(0); /* Byte count */
+ while ((c = *s++) && c!=']') {
+ if (c == '\\') { /* Store quoted char */
+ if ((c = *s++) == '\0') /* Gotta get something */
+ badpat("Class terminates badly", source, s);
+ else store(tolower(c));
+ }
+ else if (c == '-' &&
+ (pp - cp) > 1 && *s != ']' && *s != '\0') {
+ c = pp[-1]; /* Range start */
+ pp[-1] = RANGE; /* Range signal */
+ store(c); /* Re-store start */
+ c = *s++; /* Get end char and*/
+ store(tolower(c)); /* Store it */
+ }
+ else {
+ store(tolower(c)); /* Store normal char */
+ }
+ }
+ if (c != ']')
+ badpat("Unterminated class", source, s);
+ if ((c = (pp - cp)) >= 256)
+ badpat("Class too large", source, s);
+ if (c == 0)
+ badpat("Empty class", source, s);
+ *cp = c;
+ return(s);
+}
+
+/*** Store an entry in the pattern buffer **************/
+void store(int op)
+{
+ if (pp >= &pbuf[PMAX])
+ error("Pattern too complex\n");
+ *pp++ = op;
+}
+
+/*** Report a bad pattern specification ****************/
+void badpat(char *message, char *source, char *stop)
+ /* char *message; // Error message */
+ /* char *source; // Pattern start */
+ /* char *stop; // Pattern end */
+{
+ fprintf(stderr, "-GREP-E-%s, pattern is\"%s\"\n", message, source);
+ fprintf(stderr, "-GREP-E-Stopped at byte %ld, '%c'\n",
+ stop-source, stop[-1]);
+ error("?GREP-E-Bad pattern\n");
+}
+
+/*** Scan the file for the pattern in pbuf[] ***********/
+void grep(FILE *fp, char *fn)
+ /* FILE *fp; // File to process */
+ /* char *fn; // File name (for -f option) */
+{
+ int lno, count, m;
+
+ lno = 0;
+ count = 0;
+ while (fgets(lbuf, LMAX, fp)) {
+ ++lno;
+ m = match();
+ if ((m && !vflag) || (!m && vflag)) {
+ ++count;
+ if (!cflag) {
+ if (fflag && fn) {
+ file(fn);
+ fn = 0;
+ }
+ if (nflag)
+ printf("%d\t", lno);
+ printf("%s\n", lbuf);
+ }
+ }
+ }
+ if (cflag) {
+ if (fflag && fn)
+ file(fn);
+ printf("%d\n", count);
+ }
+}
+
+/*** Match line (lbuf) with pattern (pbuf) return 1 if match ***/
+int match()
+{
+ char *l; /* Line pointer */
+
+ for (l = lbuf; *l; ++l) {
+ if (pmatch(l, pbuf))
+ return(1);
+ }
+ return(0);
+}
+
+/*** Match partial line with pattern *******************/
+char *pmatch(char *line, char *pattern)
+ /* char *line; // (partial) line to match */
+ /* char *pattern; // (partial) pattern to match */
+{
+ char *l; /* Current line pointer */
+ char *p; /* Current pattern pointer */
+ char c; /* Current character */
+ char *e; /* End for STAR and PLUS match */
+ int op; /* Pattern operation */
+ int n; /* Class counter */
+ char *are; /* Start of STAR match */
+
+ l = line;
+ if (debug > 1)
+ printf("pmatch(\"%s\")\n", line);
+ p = pattern;
+ while ((op = *p++) != ENDPAT) {
+ if (debug > 1)
+ printf("byte[%ld] = 0%o, '%c', op = 0%o\n",
+ l-line, *l, *l, op);
+ switch(op) {
+
+ case CHAR:
+ if (tolower(*l++) != *p++)
+ return(0);
+ break;
+
+ case BOL:
+ if (l != lbuf)
+ return(0);
+ break;
+
+ case EOL:
+ if (*l != '\0')
+ return(0);
+ break;
+
+ case ANY:
+ if (*l++ == '\0')
+ return(0);
+ break;
+
+ case DIGIT:
+ if ((c = *l++) < '0' || (c > '9'))
+ return(0);
+ break;
+
+ case ALPHA:
+ c = tolower(*l++);
+ if (c < 'a' || c > 'z')
+ return(0);
+ break;
+
+ case NALPHA:
+ c = tolower(*l++);
+ if (c >= 'a' && c <= 'z')
+ break;
+ else if (c < '0' || c > '9')
+ return(0);
+ break;
+
+ case PUNCT:
+ c = *l++;
+ if (c == 0 || c > ' ')
+ return(0);
+ break;
+
+ case CLASS:
+ case NCLASS:
+ c = tolower(*l++);
+ n = *p++ & 0377;
+ do {
+ if (*p == RANGE) {
+ p += 3;
+ n -= 2;
+ if (c >= p[-2] && c <= p[-1])
+ break;
+ }
+ else if (c == *p++)
+ break;
+ } while (--n > 1);
+ if ((op == CLASS) == (n <= 1))
+ return(0);
+ if (op == CLASS)
+ p += n - 2;
+ break;
+
+ case MINUS:
+ e = pmatch(l, p); /* Look for a match */
+ while (*p++ != ENDPAT); /* Skip over pattern */
+ if (e) /* Got a match? */
+ l = e; /* Yes, update string */
+ break; /* Always succeeds */
+
+ case PLUS: /* One or more ... */
+ if ((l = pmatch(l, p)) == 0)
+ return(0); /* Gotta have a match */
+ case STAR: /* Zero or more ... */
+ are = l; /* Remember line start */
+ while (*l && (e = pmatch(l, p)))
+ l = e; /* Get longest match */
+ while (*p++ != ENDPAT); /* Skip over pattern */
+ while (l >= are) { /* Try to match rest */
+ if (e = pmatch(l, p))
+ return(e);
+ --l; /* Nope, try earlier */
+ }
+ return(0); /* Nothing else worked */
+
+ default:
+ printf("Bad op code %d\n", op);
+ error("Cannot happen -- match\n");
+ }
+ }
+ return(l);
+}
+
+/*** Report an error ***********************************/
+void error(char *s)
+{
+ fprintf(stderr, "%s", s);
+ exit(1);
+}
+
+/*** Main program - parse arguments & grep *************/
+int main(int argc, char **argv)
+{
+ char *p;
+ int c, i;
+ int gotpattern;
+
+ FILE *f;
+
+ if (argc <= 1)
+ usage("No arguments");
+ if (argc == 2 && argv[1][0] == '?' && argv[1][1] == 0) {
+ help(documentation);
+ help(patdoc);
+ return 0;
+ }
+ nfile = argc-1;
+ gotpattern = 0;
+ for (i=1; i < argc; ++i) {
+ p = argv[i];
+ if (*p == '-') {
+ ++p;
+ while (c = *p++) {
+ switch(tolower(c)) {
+
+ case '?':
+ help(documentation);
+ break;
+
+ case 'C':
+ case 'c':
+ ++cflag;
+ break;
+
+ case 'D':
+ case 'd':
+ ++debug;
+ break;
+
+ case 'F':
+ case 'f':
+ ++fflag;
+ break;
+
+ case 'n':
+ case 'N':
+ ++nflag;
+ break;
+
+ case 'v':
+ case 'V':
+ ++vflag;
+ break;
+
+ default:
+ usage("Unknown flag");
+ }
+ }
+ argv[i] = 0;
+ --nfile;
+ } else if (!gotpattern) {
+ compile(p);
+ argv[i] = 0;
+ ++gotpattern;
+ --nfile;
+ }
+ }
+ if (!gotpattern)
+ usage("No pattern");
+ if (nfile == 0)
+ grep(stdin, 0);
+ else {
+ fflag = fflag ^ (nfile > 0);
+ for (i=1; i < argc; ++i) {
+ if (p = argv[i]) {
+ if ((f=fopen(p, "r")) == NULL)
+ cant(p);
+ else {
+ grep(f, p);
+ fclose(f);
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/46_grep.expect b/05/tcc-0.9.27/tests/tests2/46_grep.expect
new file mode 100644
index 0000000..e8a6791
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/46_grep.expect
@@ -0,0 +1,3 @@
+File 46_grep.c:
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+
diff --git a/05/tcc-0.9.27/tests/tests2/47_switch_return.c b/05/tcc-0.9.27/tests/tests2/47_switch_return.c
new file mode 100644
index 0000000..1ec7924
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/47_switch_return.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+void fred(int x)
+{
+ switch (x)
+ {
+ case 1: printf("1\n"); return;
+ case 2: printf("2\n"); break;
+ case 3: printf("3\n"); return;
+ }
+
+ printf("out\n");
+}
+
+int main()
+{
+ fred(1);
+ fred(2);
+ fred(3);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/47_switch_return.expect b/05/tcc-0.9.27/tests/tests2/47_switch_return.expect
new file mode 100644
index 0000000..b6deb7e
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/47_switch_return.expect
@@ -0,0 +1,4 @@
+1
+2
+out
+3
diff --git a/05/tcc-0.9.27/tests/tests2/48_nested_break.c b/05/tcc-0.9.27/tests/tests2/48_nested_break.c
new file mode 100644
index 0000000..5bc5ba4
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/48_nested_break.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+
+int main()
+{
+ int a;
+ char b;
+
+ a = 0;
+ while (a < 2)
+ {
+ printf("%d", a++);
+ break;
+
+ b = 'A';
+ while (b < 'C')
+ {
+ printf("%c", b++);
+ }
+ printf("e");
+ }
+ printf("\n");
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/48_nested_break.expect b/05/tcc-0.9.27/tests/tests2/48_nested_break.expect
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/48_nested_break.expect
@@ -0,0 +1 @@
+0
diff --git a/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.c b/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.c
new file mode 100644
index 0000000..0cbe57d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+struct point
+{
+ double x;
+ double y;
+};
+
+struct point point_array[100];
+
+int main()
+{
+ int my_point = 10;
+
+ point_array[my_point].x = 12.34;
+ point_array[my_point].y = 56.78;
+
+ printf("%f, %f\n", point_array[my_point].x, point_array[my_point].y);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.expect b/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.expect
new file mode 100644
index 0000000..1da66db
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/49_bracket_evaluation.expect
@@ -0,0 +1 @@
+12.340000, 56.780000
diff --git a/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.c b/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.c
new file mode 100644
index 0000000..ddec08c
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+int fred()
+{
+ printf("fred\n");
+ return 0;
+}
+
+int joe()
+{
+ printf("joe\n");
+ return 1;
+}
+
+int main()
+{
+ printf("%d\n", fred() && joe());
+ printf("%d\n", fred() || joe());
+ printf("%d\n", joe() && fred());
+ printf("%d\n", joe() || fred());
+ printf("%d\n", fred() && (1 + joe()));
+ printf("%d\n", fred() || (0 + joe()));
+ printf("%d\n", joe() && (0 + fred()));
+ printf("%d\n", joe() || (1 + fred()));
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.expect b/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.expect
new file mode 100644
index 0000000..d6174ae
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/50_logical_second_arg.expect
@@ -0,0 +1,20 @@
+fred
+0
+fred
+joe
+1
+joe
+fred
+0
+joe
+1
+fred
+0
+fred
+joe
+1
+joe
+fred
+0
+joe
+1
diff --git a/05/tcc-0.9.27/tests/tests2/51_static.c b/05/tcc-0.9.27/tests/tests2/51_static.c
new file mode 100644
index 0000000..d6c0917
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/51_static.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+static int fred = 1234;
+static int joe;
+
+void henry()
+{
+ static int fred = 4567;
+
+ printf("%d\n", fred);
+ fred++;
+}
+
+int main()
+{
+ printf("%d\n", fred);
+ henry();
+ henry();
+ henry();
+ henry();
+ printf("%d\n", fred);
+ fred = 8901;
+ joe = 2345;
+ printf("%d\n", fred);
+ printf("%d\n", joe);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/51_static.expect b/05/tcc-0.9.27/tests/tests2/51_static.expect
new file mode 100644
index 0000000..18224fa
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/51_static.expect
@@ -0,0 +1,8 @@
+1234
+4567
+4568
+4569
+4570
+1234
+8901
+2345
diff --git a/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.c b/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.c
new file mode 100644
index 0000000..d0395b2
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+
+enum fred { a, b, c };
+
+int main()
+{
+ printf("a=%d\n", a);
+ printf("b=%d\n", b);
+ printf("c=%d\n", c);
+
+ enum fred d;
+
+ typedef enum { e, f, g } h;
+ typedef enum { i, j, k } m;
+
+ printf("e=%d\n", e);
+ printf("f=%d\n", f);
+ printf("g=%d\n", g);
+
+ printf("i=%d\n", i);
+ printf("j=%d\n", j);
+ printf("k=%d\n", k);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.expect b/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.expect
new file mode 100644
index 0000000..84f2ac8
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/52_unnamed_enum.expect
@@ -0,0 +1,9 @@
+a=0
+b=1
+c=2
+e=0
+f=1
+g=2
+i=0
+j=1
+k=2
diff --git a/05/tcc-0.9.27/tests/tests2/54_goto.c b/05/tcc-0.9.27/tests/tests2/54_goto.c
new file mode 100644
index 0000000..2e151bb
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/54_goto.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+
+void fred()
+{
+ printf("In fred()\n");
+ goto done;
+ printf("In middle\n");
+done:
+ printf("At end\n");
+}
+
+void joe()
+{
+ int b = 5678;
+
+ printf("In joe()\n");
+
+ {
+ int c = 1234;
+ printf("c = %d\n", c);
+ goto outer;
+ printf("uh-oh\n");
+ }
+
+outer:
+
+ printf("done\n");
+}
+
+void henry()
+{
+ int a;
+
+ printf("In henry()\n");
+ goto inner;
+
+ {
+ int b;
+inner:
+ b = 1234;
+ printf("b = %d\n", b);
+ }
+
+ printf("done\n");
+}
+
+int main()
+{
+ fred();
+ joe();
+ henry();
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/54_goto.expect b/05/tcc-0.9.27/tests/tests2/54_goto.expect
new file mode 100644
index 0000000..8e553fa
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/54_goto.expect
@@ -0,0 +1,8 @@
+In fred()
+At end
+In joe()
+c = 1234
+done
+In henry()
+b = 1234
+done
diff --git a/05/tcc-0.9.27/tests/tests2/55_lshift_type.c b/05/tcc-0.9.27/tests/tests2/55_lshift_type.c
new file mode 100644
index 0000000..aa3e51a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/55_lshift_type.c
@@ -0,0 +1,52 @@
+/* $Id: lshift-type.c 53089 2012-07-06 11:18:26Z vinc17/ypig $
+
+Tests on left-shift type, written by Vincent Lefevre <vincent@vinc17.net>.
+
+ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on
+each of the operands. The type of the result is that of the promoted
+left operand."
+*/
+
+#include <stdio.h>
+
+#define PTYPE(M) ((M) < 0 || -(M) < 0 ? -1 : 1) * (int) sizeof((M)+0)
+#define CHECK(X,T) check(#X, PTYPE(X), PTYPE((X) << (T) 1))
+#define TEST1(X,T) do { CHECK(X,T); CHECK(X,unsigned T); } while (0)
+#define TEST2(X) \
+ do \
+ { \
+ TEST1((X),short); \
+ TEST1((X),int); \
+ TEST1((X),long); \
+ TEST1((X),long long); \
+ } \
+ while (0)
+#define TEST3(X,T) do { TEST2((T)(X)); TEST2((unsigned T)(X)); } while (0)
+#define TEST4(X) \
+ do \
+ { \
+ TEST3((X),short); \
+ TEST3((X),int); \
+ TEST3((X),long); \
+ TEST3((X),long long); \
+ } \
+ while (0)
+
+static int debug, nfailed = 0;
+
+static void check (const char *s, int arg1, int shift)
+{
+ int failed = arg1 != shift;
+ if (debug || failed)
+ printf ("%s %d %d\n", s, arg1, shift);
+ nfailed += failed;
+}
+
+int main (int argc, char **argv)
+{
+ debug = argc > 1;
+ TEST4(1);
+ TEST4(-1);
+ printf ("%d test(s) failed\n", nfailed);
+ return nfailed != 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/55_lshift_type.expect b/05/tcc-0.9.27/tests/tests2/55_lshift_type.expect
new file mode 100644
index 0000000..8523767
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/55_lshift_type.expect
@@ -0,0 +1 @@
+0 test(s) failed
diff --git a/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.c b/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.c
new file mode 100644
index 0000000..0028caf
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.c
@@ -0,0 +1,51 @@
+#if defined test_56_btype_excess_1
+struct A {} int i;
+
+#elif defined test_57_btype_excess_2
+char int i;
+
+#elif defined test_58_function_redefinition
+int f(void) { return 0; }
+int f(void) { return 1; }
+
+#elif defined test_global_redefinition
+int xxx = 1;
+int xxx;
+int xxx = 2;
+
+#elif defined test_59_function_array
+int (*fct)[42](int x);
+
+#elif defined test_60_enum_redefinition
+enum color { RED, GREEN, BLUE };
+enum color { R, G, B };
+enum color c;
+
+#elif defined test_62_enumerator_redefinition
+enum color { RED, GREEN, BLUE };
+enum rgb { RED, G, B};
+enum color c = RED;
+
+#elif defined test_63_local_enumerator_redefinition
+enum {
+ FOO,
+ BAR
+};
+
+int main(void)
+{
+ enum {
+ FOO = 2,
+ BAR
+ };
+
+ return BAR - FOO;
+}
+
+#elif defined test_61_undefined_enum
+enum rgb3 c = 42;
+
+#elif defined test_74_non_const_init
+int i = i++;
+
+#endif
diff --git a/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.expect b/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.expect
new file mode 100644
index 0000000..ed6a690
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/60_errors_and_warnings.expect
@@ -0,0 +1,28 @@
+[test_56_btype_excess_1]
+60_errors_and_warnings.c:2: error: too many basic types
+
+[test_57_btype_excess_2]
+60_errors_and_warnings.c:5: error: too many basic types
+
+[test_58_function_redefinition]
+60_errors_and_warnings.c:9: error: redefinition of 'f'
+
+[test_global_redefinition]
+60_errors_and_warnings.c:14: error: redefinition of 'xxx'
+
+[test_59_function_array]
+60_errors_and_warnings.c:17: error: declaration of an array of functions
+
+[test_60_enum_redefinition]
+60_errors_and_warnings.c:21: error: struct/union/enum already defined
+
+[test_62_enumerator_redefinition]
+60_errors_and_warnings.c:26: error: redefinition of enumerator 'RED'
+
+[test_63_local_enumerator_redefinition]
+
+[test_61_undefined_enum]
+60_errors_and_warnings.c:46: error: unknown type size
+
+[test_74_non_const_init]
+60_errors_and_warnings.c:49: error: initializer element is not constant
diff --git a/05/tcc-0.9.27/tests/tests2/64_macro_nesting.c b/05/tcc-0.9.27/tests/tests2/64_macro_nesting.c
new file mode 100644
index 0000000..676e5d3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/64_macro_nesting.c
@@ -0,0 +1,12 @@
+#include <stdio.h> // printf()
+
+#define CAT2(a,b) a##b
+#define CAT(a,b) CAT2(a,b)
+#define AB(x) CAT(x,y)
+
+int main(void)
+{
+ int xy = 42;
+ printf("%d\n", CAT(A,B)(x));
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/64_macro_nesting.expect b/05/tcc-0.9.27/tests/tests2/64_macro_nesting.expect
new file mode 100644
index 0000000..d81cc07
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/64_macro_nesting.expect
@@ -0,0 +1 @@
+42
diff --git a/05/tcc-0.9.27/tests/tests2/67_macro_concat.c b/05/tcc-0.9.27/tests/tests2/67_macro_concat.c
new file mode 100644
index 0000000..c580d3a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/67_macro_concat.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+#define P(A,B) A ## B ; bob
+#define Q(A,B) A ## B+
+
+int main(void)
+{
+ int bob, jim = 21;
+ bob = P(jim,) *= 2;
+ printf("jim: %d, bob: %d\n", jim, bob);
+ jim = 60 Q(+,)3;
+ printf("jim: %d\n", jim);
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/67_macro_concat.expect b/05/tcc-0.9.27/tests/tests2/67_macro_concat.expect
new file mode 100644
index 0000000..8386c2d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/67_macro_concat.expect
@@ -0,0 +1,2 @@
+jim: 21, bob: 42
+jim: 63
diff --git a/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.c b/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.c
new file mode 100644
index 0000000..012fb4f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.c
@@ -0,0 +1,77 @@
+#include <stdio.h>
+
+int main()
+{
+ /* decimal floating constant */
+ float fa0 = .123f;
+ float fa1 = .123E12F;
+ float fa2 = .123e-12f;
+ float fa3 = .123e+12f;
+ printf("%f\n%f\n%f\n%f\n\n", fa0, fa1, fa2, fa3);
+
+ float fb0 = 123.123f;
+ float fb1 = 123.123E12F;
+ float fb2 = 123.123e-12f;
+ float fb3 = 123.123e+12f;
+ printf("%f\n%f\n%f\n%f\n\n", fb0, fb1, fb2, fb3);
+
+ float fc0 = 123.f;
+ float fc1 = 123.E12F;
+ float fc2 = 123.e-12f;
+ float fc3 = 123.e+12f;
+ printf("%f\n%f\n%f\n%f\n\n", fc0, fc1, fc2, fc3);
+
+ float fd0 = 123E12F;
+ float fd1 = 123e-12f;
+ float fd2 = 123e+12f;
+ printf("%f\n%f\n%f\n\n", fd0, fd1, fd2);
+ printf("\n");
+
+ /* hexadecimal floating constant */
+ double da0 = 0X.1ACP12;
+ double da1 = 0x.1acp-12;
+ double da2 = 0x.1acp+12;
+ printf("%f\n%f\n%f\n\n", da0, da1, da2);
+
+ double db0 = 0X1AC.BDP12;
+ double db1 = 0x1ac.bdp-12;
+ double db2 = 0x1ac.dbp+12;
+ printf("%f\n%f\n%f\n\n", db0, db1, db2);
+
+ double dc0 = 0X1AC.P12;
+ double dc1 = 0x1ac.p-12;
+ double dc2 = 0x1ac.p+12;
+ printf("%f\n%f\n%f\n\n", dc0, dc1, dc2);
+
+ double dd0 = 0X1ACP12;
+ double dd1 = 0x1acp-12;
+ double dd2 = 0x1acp+12;
+ printf("%f\n%f\n%f\n\n", dd0, dd1, dd2);
+ printf("\n");
+
+#ifdef __TINYC__
+ /* TCC extension
+ binary floating constant */
+ long double la0 = 0B.110101100P12L;
+ long double la1 = 0b.110101100p-12l;
+ long double la2 = 0b.110101100p+12l;
+ printf("%Lf\n%Lf\n%Lf\n\n", la0, la1, la2);
+
+ long double lb0 = 0B110101100.10111101P12L;
+ long double lb1 = 0b110101100.10111101p-12l;
+ long double lb2 = 0b110101100.10111101p+12l;
+ printf("%Lf\n%Lf\n%Lf\n\n", lb0, lb1, lb2);
+
+ long double lc0 = 0B110101100.P12L;
+ long double lc1 = 0b110101100.p-12l;
+ long double lc2 = 0b110101100.p+12l;
+ printf("%Lf\n%Lf\n%Lf\n\n", lc0, lc1, lc2);
+
+ long double ld0 = 0B110101100P12L;
+ long double ld1 = 0b110101100p-12l;
+ long double ld2 = 0b110101100p+12l;
+ printf("%Lf\n%Lf\n%Lf\n\n", ld0, ld1, ld2);
+#endif
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.expect b/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.expect
new file mode 100644
index 0000000..7eb1efb
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/70_floating_point_literals.expect
@@ -0,0 +1,53 @@
+0.123000
+122999996416.000000
+0.000000
+122999996416.000000
+
+123.123001
+123122997002240.000000
+0.000000
+123122997002240.000000
+
+123.000000
+123000003231744.000000
+0.000000
+123000003231744.000000
+
+123000003231744.000000
+0.000000
+123000003231744.000000
+
+
+428.000000
+0.000026
+428.000000
+
+1756112.000000
+0.104672
+1756592.000000
+
+1753088.000000
+0.104492
+1753088.000000
+
+1753088.000000
+0.104492
+1753088.000000
+
+
+3424.000000
+0.000204
+3424.000000
+
+1756112.000000
+0.104672
+1756112.000000
+
+1753088.000000
+0.104492
+1753088.000000
+
+1753088.000000
+0.104492
+1753088.000000
+
diff --git a/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.c b/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.c
new file mode 100644
index 0000000..f0d3511
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+#define T(a,b,c) a b c
+
+int main(void)
+{
+ printf("%d", T(1,+,2) T(+,,) T(,2,*) T(,7,) T(,,));
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.expect b/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.expect
new file mode 100644
index 0000000..98d9bcb
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/71_macro_empty_arg.expect
@@ -0,0 +1 @@
+17
diff --git a/05/tcc-0.9.27/tests/tests2/72_long_long_constant.c b/05/tcc-0.9.27/tests/tests2/72_long_long_constant.c
new file mode 100644
index 0000000..6608213
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/72_long_long_constant.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+int main()
+{
+ long long int res = 0;
+
+ if (res < -2147483648LL) {
+ printf("Error: 0 < -2147483648\n");
+ return 1;
+ }
+ else
+ if (2147483647LL < res) {
+ printf("Error: 2147483647 < 0\n");
+ return 2;
+ }
+ else
+ printf("long long constant test ok.\n");
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/72_long_long_constant.expect b/05/tcc-0.9.27/tests/tests2/72_long_long_constant.expect
new file mode 100644
index 0000000..dda9e66
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/72_long_long_constant.expect
@@ -0,0 +1 @@
+long long constant test ok.
diff --git a/05/tcc-0.9.27/tests/tests2/73_arm64.c b/05/tcc-0.9.27/tests/tests2/73_arm64.c
new file mode 100644
index 0000000..8de61b3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/73_arm64.c
@@ -0,0 +1,527 @@
+// This program is designed to test some arm64-specific things, such as the
+// calling convention, but should give the same results on any architecture.
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+
+struct s1 { char x[1]; } s1 = { "0" };
+struct s2 { char x[2]; } s2 = { "12" };
+struct s3 { char x[3]; } s3 = { "345" };
+struct s4 { char x[4]; } s4 = { "6789" };
+struct s5 { char x[5]; } s5 = { "abcde" };
+struct s6 { char x[6]; } s6 = { "fghijk" };
+struct s7 { char x[7]; } s7 = { "lmnopqr" };
+struct s8 { char x[8]; } s8 = { "stuvwxyz" };
+struct s9 { char x[9]; } s9 = { "ABCDEFGHI" };
+struct s10 { char x[10]; } s10 = { "JKLMNOPQRS" };
+struct s11 { char x[11]; } s11 = { "TUVWXYZ0123" };
+struct s12 { char x[12]; } s12 = { "456789abcdef" };
+struct s13 { char x[13]; } s13 = { "ghijklmnopqrs" };
+struct s14 { char x[14]; } s14 = { "tuvwxyzABCDEFG" };
+struct s15 { char x[15]; } s15 = { "HIJKLMNOPQRSTUV" };
+struct s16 { char x[16]; } s16 = { "WXYZ0123456789ab" };
+struct s17 { char x[17]; } s17 = { "cdefghijklmnopqrs" };
+
+struct hfa11 { float a; } hfa11 = { 11.1 };
+struct hfa12 { float a, b; } hfa12 = { 12.1, 12.2 };
+struct hfa13 { float a, b, c; } hfa13 = { 13.1, 13.2, 13.3 };
+struct hfa14 { float a, b, c, d; } hfa14 = { 14.1, 14.2, 14.3, 14.4 };
+
+struct hfa21 { double a; } hfa21 = { 21.1 };
+struct hfa22 { double a, b; } hfa22 = { 22.1, 22.2 };
+struct hfa23 { double a, b, c; } hfa23 = { 23.1, 23.2, 23.3 };
+struct hfa24 { double a, b, c, d; } hfa24 = { 24.1, 24.2, 24.3, 24.4 };
+
+struct hfa31 { long double a; } hfa31 = { 31.1 };
+struct hfa32 { long double a, b; } hfa32 = { 32.1, 32.2 };
+struct hfa33 { long double a, b, c; } hfa33 = { 33.1, 33.2, 33.3 };
+struct hfa34 { long double a, b, c, d; } hfa34 = { 34.1, 34.2, 34.3, 34.4 };
+
+void fa_s1(struct s1 a) { printf("%.1s\n", a.x); }
+void fa_s2(struct s2 a) { printf("%.2s\n", a.x); }
+void fa_s3(struct s3 a) { printf("%.3s\n", a.x); }
+void fa_s4(struct s4 a) { printf("%.4s\n", a.x); }
+void fa_s5(struct s5 a) { printf("%.5s\n", a.x); }
+void fa_s6(struct s6 a) { printf("%.6s\n", a.x); }
+void fa_s7(struct s7 a) { printf("%.7s\n", a.x); }
+void fa_s8(struct s8 a) { printf("%.8s\n", a.x); }
+void fa_s9(struct s9 a) { printf("%.9s\n", a.x); }
+void fa_s10(struct s10 a) { printf("%.10s\n", a.x); }
+void fa_s11(struct s11 a) { printf("%.11s\n", a.x); }
+void fa_s12(struct s12 a) { printf("%.12s\n", a.x); }
+void fa_s13(struct s13 a) { printf("%.13s\n", a.x); }
+void fa_s14(struct s14 a) { printf("%.14s\n", a.x); }
+void fa_s15(struct s15 a) { printf("%.15s\n", a.x); }
+void fa_s16(struct s16 a) { printf("%.16s\n", a.x); }
+void fa_s17(struct s17 a) { printf("%.17s\n", a.x); }
+
+void fa_hfa11(struct hfa11 a)
+{ printf("%.1f\n", a.a); }
+void fa_hfa12(struct hfa12 a)
+{ printf("%.1f %.1f\n", a.a, a.a); }
+void fa_hfa13(struct hfa13 a)
+{ printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
+void fa_hfa14(struct hfa14 a)
+{ printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
+
+void fa_hfa21(struct hfa21 a)
+{ printf("%.1f\n", a.a); }
+void fa_hfa22(struct hfa22 a)
+{ printf("%.1f %.1f\n", a.a, a.a); }
+void fa_hfa23(struct hfa23 a)
+{ printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
+void fa_hfa24(struct hfa24 a)
+{ printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
+
+void fa_hfa31(struct hfa31 a)
+{ printf("%.1Lf\n", a.a); }
+void fa_hfa32(struct hfa32 a)
+{ printf("%.1Lf %.1Lf\n", a.a, a.a); }
+void fa_hfa33(struct hfa33 a)
+{ printf("%.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c); }
+void fa_hfa34(struct hfa34 a)
+{ printf("%.1Lf %.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c, a.d); }
+
+void fa1(struct s8 a, struct s9 b, struct s10 c, struct s11 d,
+ struct s12 e, struct s13 f)
+{
+ printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
+}
+
+void fa2(struct s9 a, struct s10 b, struct s11 c, struct s12 d,
+ struct s13 e, struct s14 f)
+{
+ printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
+}
+
+void fa3(struct hfa14 a, struct hfa23 b, struct hfa32 c)
+{
+ printf("%.1f %.1f %.1f %.1f %.1Lf %.1Lf\n",
+ a.a, a.d, b.a, b.c, c.a, c.b);
+}
+
+void fa4(struct s1 a, struct hfa14 b, struct s2 c, struct hfa24 d,
+ struct s3 e, struct hfa34 f)
+{
+ printf("%.1s %.1f %.1f %.2s %.1f %.1f %.3s %.1Lf %.1Lf\n",
+ a.x, b.a, b.d, c.x, d.a, d.d, e.x, f.a, f.d);
+}
+
+void arg(void)
+{
+ printf("Arguments:\n");
+ fa_s1(s1);
+ fa_s2(s2);
+ fa_s3(s3);
+ fa_s4(s4);
+ fa_s5(s5);
+ fa_s6(s6);
+ fa_s7(s7);
+ fa_s8(s8);
+ fa_s9(s9);
+ fa_s10(s10);
+ fa_s11(s11);
+ fa_s12(s12);
+ fa_s13(s13);
+ fa_s14(s14);
+ fa_s15(s15);
+ fa_s16(s16);
+ fa_s17(s17);
+ fa_hfa11(hfa11);
+ fa_hfa12(hfa12);
+ fa_hfa13(hfa13);
+ fa_hfa14(hfa14);
+ fa_hfa21(hfa21);
+ fa_hfa22(hfa22);
+ fa_hfa23(hfa23);
+ fa_hfa24(hfa24);
+ fa_hfa31(hfa31);
+ fa_hfa32(hfa32);
+ fa_hfa33(hfa33);
+ fa_hfa34(hfa34);
+ fa1(s8, s9, s10, s11, s12, s13);
+ fa2(s9, s10, s11, s12, s13, s14);
+ fa3(hfa14, hfa23, hfa32);
+ fa4(s1, hfa14, s2, hfa24, s3, hfa34);
+}
+
+struct s1 fr_s1(void) { return s1; }
+struct s2 fr_s2(void) { return s2; }
+struct s3 fr_s3(void) { return s3; }
+struct s4 fr_s4(void) { return s4; }
+struct s5 fr_s5(void) { return s5; }
+struct s6 fr_s6(void) { return s6; }
+struct s7 fr_s7(void) { return s7; }
+struct s8 fr_s8(void) { return s8; }
+struct s9 fr_s9(void) { return s9; }
+struct s10 fr_s10(void) { return s10; }
+struct s11 fr_s11(void) { return s11; }
+struct s12 fr_s12(void) { return s12; }
+struct s13 fr_s13(void) { return s13; }
+struct s14 fr_s14(void) { return s14; }
+struct s15 fr_s15(void) { return s15; }
+struct s16 fr_s16(void) { return s16; }
+struct s17 fr_s17(void) { return s17; }
+
+struct hfa11 fr_hfa11(void) { return hfa11; }
+struct hfa12 fr_hfa12(void) { return hfa12; }
+struct hfa13 fr_hfa13(void) { return hfa13; }
+struct hfa14 fr_hfa14(void) { return hfa14; }
+
+struct hfa21 fr_hfa21(void) { return hfa21; }
+struct hfa22 fr_hfa22(void) { return hfa22; }
+struct hfa23 fr_hfa23(void) { return hfa23; }
+struct hfa24 fr_hfa24(void) { return hfa24; }
+
+struct hfa31 fr_hfa31(void) { return hfa31; }
+struct hfa32 fr_hfa32(void) { return hfa32; }
+struct hfa33 fr_hfa33(void) { return hfa33; }
+struct hfa34 fr_hfa34(void) { return hfa34; }
+
+void ret(void)
+{
+ struct s1 t1 = fr_s1();
+ struct s2 t2 = fr_s2();
+ struct s3 t3 = fr_s3();
+ struct s4 t4 = fr_s4();
+ struct s5 t5 = fr_s5();
+ struct s6 t6 = fr_s6();
+ struct s7 t7 = fr_s7();
+ struct s8 t8 = fr_s8();
+ struct s9 t9 = fr_s9();
+ struct s10 t10 = fr_s10();
+ struct s11 t11 = fr_s11();
+ struct s12 t12 = fr_s12();
+ struct s13 t13 = fr_s13();
+ struct s14 t14 = fr_s14();
+ struct s15 t15 = fr_s15();
+ struct s16 t16 = fr_s16();
+ struct s17 t17 = fr_s17();
+ printf("Return values:\n");
+ printf("%.1s\n", t1.x);
+ printf("%.2s\n", t2.x);
+ printf("%.3s\n", t3.x);
+ printf("%.4s\n", t4.x);
+ printf("%.5s\n", t5.x);
+ printf("%.6s\n", t6.x);
+ printf("%.7s\n", t7.x);
+ printf("%.8s\n", t8.x);
+ printf("%.9s\n", t9.x);
+ printf("%.10s\n", t10.x);
+ printf("%.11s\n", t11.x);
+ printf("%.12s\n", t12.x);
+ printf("%.13s\n", t13.x);
+ printf("%.14s\n", t14.x);
+ printf("%.15s\n", t15.x);
+ printf("%.16s\n", t16.x);
+ printf("%.17s\n", t17.x);
+ printf("%.1f\n", fr_hfa11().a);
+ printf("%.1f %.1f\n", fr_hfa12().a, fr_hfa12().b);
+ printf("%.1f %.1f\n", fr_hfa13().a, fr_hfa13().c);
+ printf("%.1f %.1f\n", fr_hfa14().a, fr_hfa14().d);
+ printf("%.1f\n", fr_hfa21().a);
+ printf("%.1f %.1f\n", fr_hfa22().a, fr_hfa22().b);
+ printf("%.1f %.1f\n", fr_hfa23().a, fr_hfa23().c);
+ printf("%.1f %.1f\n", fr_hfa24().a, fr_hfa24().d);
+ printf("%.1Lf\n", fr_hfa31().a);
+ printf("%.1Lf %.1Lf\n", fr_hfa32().a, fr_hfa32().b);
+ printf("%.1Lf %.1Lf\n", fr_hfa33().a, fr_hfa33().c);
+ printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
+}
+
+int match(const char **s, const char *f)
+{
+ const char *p = *s;
+ for (p = *s; *f && *f == *p; f++, p++)
+ ;
+ if (!*f) {
+ *s = p - 1;
+ return 1;
+ }
+ return 0;
+}
+
+void myprintf(const char *format, ...)
+{
+ const char *s;
+ va_list ap;
+ va_start(ap, format);
+ for (s = format; *s; s++) {
+ if (match(&s, "%7s")) {
+ struct s7 t7 = va_arg(ap, struct s7);
+ printf("%.7s", t7.x);
+ }
+ else if (match(&s, "%9s")) {
+ struct s9 t9 = va_arg(ap, struct s9);
+ printf("%.9s", t9.x);
+ }
+ else if (match(&s, "%hfa11")) {
+ struct hfa11 x = va_arg(ap, struct hfa11);
+ printf("%.1f,%.1f", x.a, x.a);
+ }
+ else if (match(&s, "%hfa12")) {
+ struct hfa12 x = va_arg(ap, struct hfa12);
+ printf("%.1f,%.1f", x.a, x.b);
+ }
+ else if (match(&s, "%hfa13")) {
+ struct hfa13 x = va_arg(ap, struct hfa13);
+ printf("%.1f,%.1f", x.a, x.c);
+ }
+ else if (match(&s, "%hfa14")) {
+ struct hfa14 x = va_arg(ap, struct hfa14);
+ printf("%.1f,%.1f", x.a, x.d);
+ }
+ else if (match(&s, "%hfa21")) {
+ struct hfa21 x = va_arg(ap, struct hfa21);
+ printf("%.1f,%.1f", x.a, x.a);
+ }
+ else if (match(&s, "%hfa22")) {
+ struct hfa22 x = va_arg(ap, struct hfa22);
+ printf("%.1f,%.1f", x.a, x.b);
+ }
+ else if (match(&s, "%hfa23")) {
+ struct hfa23 x = va_arg(ap, struct hfa23);
+ printf("%.1f,%.1f", x.a, x.c);
+ }
+ else if (match(&s, "%hfa24")) {
+ struct hfa24 x = va_arg(ap, struct hfa24);
+ printf("%.1f,%.1f", x.a, x.d);
+ }
+ else if (match(&s, "%hfa31")) {
+ struct hfa31 x = va_arg(ap, struct hfa31);
+ printf("%.1Lf,%.1Lf", x.a, x.a);
+ }
+ else if (match(&s, "%hfa32")) {
+ struct hfa32 x = va_arg(ap, struct hfa32);
+ printf("%.1Lf,%.1Lf", x.a, x.b);
+ }
+ else if (match(&s, "%hfa33")) {
+ struct hfa33 x = va_arg(ap, struct hfa33);
+ printf("%.1Lf,%.1Lf", x.a, x.c);
+ }
+ else if (match(&s, "%hfa34")) {
+ struct hfa34 x = va_arg(ap, struct hfa34);
+ printf("%.1Lf,%.1Lf", x.a, x.d);
+ }
+ else
+ putchar(*s);
+ }
+ putchar('\n');
+}
+
+void stdarg(void)
+{
+ printf("stdarg:\n");
+ myprintf("%9s %9s %9s %9s %9s %9s", s9, s9, s9, s9, s9, s9);
+ myprintf("%7s %9s %9s %9s %9s %9s", s7, s9, s9, s9, s9, s9);
+
+ myprintf("HFA long double:");
+ myprintf("%hfa34 %hfa34 %hfa34 %hfa34", hfa34, hfa34, hfa34, hfa34);
+ myprintf("%hfa33 %hfa34 %hfa34 %hfa34", hfa33, hfa34, hfa34, hfa34);
+ myprintf("%hfa32 %hfa34 %hfa34 %hfa34", hfa32, hfa34, hfa34, hfa34);
+ myprintf("%hfa31 %hfa34 %hfa34 %hfa34", hfa31, hfa34, hfa34, hfa34);
+
+ myprintf("%hfa32 %hfa33 %hfa33 %hfa33 %hfa33",
+ hfa32, hfa33, hfa33, hfa33, hfa33);
+ myprintf("%hfa31 %hfa33 %hfa33 %hfa33 %hfa33",
+ hfa31, hfa33, hfa33, hfa33, hfa33);
+ myprintf("%hfa33 %hfa33 %hfa33 %hfa33",
+ hfa33, hfa33, hfa33, hfa33);
+
+ myprintf("%hfa34 %hfa32 %hfa32 %hfa32 %hfa32",
+ hfa34, hfa32, hfa32, hfa32, hfa32);
+ myprintf("%hfa33 %hfa32 %hfa32 %hfa32 %hfa32",
+ hfa33, hfa32, hfa32, hfa32, hfa32);
+
+ myprintf("%hfa34 %hfa32 %hfa31 %hfa31 %hfa31 %hfa31",
+ hfa34, hfa32, hfa31, hfa31, hfa31, hfa31);
+
+ myprintf("HFA double:");
+ myprintf("%hfa24 %hfa24 %hfa24 %hfa24", hfa24, hfa24, hfa24, hfa24);
+ myprintf("%hfa23 %hfa24 %hfa24 %hfa24", hfa23, hfa24, hfa24, hfa24);
+ myprintf("%hfa22 %hfa24 %hfa24 %hfa24", hfa22, hfa24, hfa24, hfa24);
+ myprintf("%hfa21 %hfa24 %hfa24 %hfa24", hfa21, hfa24, hfa24, hfa24);
+
+ myprintf("%hfa22 %hfa23 %hfa23 %hfa23 %hfa23",
+ hfa22, hfa23, hfa23, hfa23, hfa23);
+ myprintf("%hfa21 %hfa23 %hfa23 %hfa23 %hfa23",
+ hfa21, hfa23, hfa23, hfa23, hfa23);
+ myprintf("%hfa23 %hfa23 %hfa23 %hfa23",
+ hfa23, hfa23, hfa23, hfa23);
+
+ myprintf("%hfa24 %hfa22 %hfa22 %hfa22 %hfa22",
+ hfa24, hfa22, hfa22, hfa22, hfa22);
+ myprintf("%hfa23 %hfa22 %hfa22 %hfa22 %hfa22",
+ hfa23, hfa22, hfa22, hfa22, hfa22);
+
+ myprintf("%hfa24 %hfa22 %hfa21 %hfa21 %hfa21 %hfa21",
+ hfa24, hfa22, hfa21, hfa21, hfa21, hfa21);
+
+ myprintf("HFA float:");
+ myprintf("%hfa14 %hfa14 %hfa14 %hfa14", hfa14, hfa14, hfa14, hfa14);
+ myprintf("%hfa13 %hfa14 %hfa14 %hfa14", hfa13, hfa14, hfa14, hfa14);
+ myprintf("%hfa12 %hfa14 %hfa14 %hfa14", hfa12, hfa14, hfa14, hfa14);
+ myprintf("%hfa11 %hfa14 %hfa14 %hfa14", hfa11, hfa14, hfa14, hfa14);
+
+ myprintf("%hfa12 %hfa13 %hfa13 %hfa13 %hfa13",
+ hfa12, hfa13, hfa13, hfa13, hfa13);
+ myprintf("%hfa11 %hfa13 %hfa13 %hfa13 %hfa13",
+ hfa11, hfa13, hfa13, hfa13, hfa13);
+ myprintf("%hfa13 %hfa13 %hfa13 %hfa13",
+ hfa13, hfa13, hfa13, hfa13);
+
+ myprintf("%hfa14 %hfa12 %hfa12 %hfa12 %hfa12",
+ hfa14, hfa12, hfa12, hfa12, hfa12);
+ myprintf("%hfa13 %hfa12 %hfa12 %hfa12 %hfa12",
+ hfa13, hfa12, hfa12, hfa12, hfa12);
+
+ myprintf("%hfa14 %hfa12 %hfa11 %hfa11 %hfa11 %hfa11",
+ hfa14, hfa12, hfa11, hfa11, hfa11, hfa11);
+}
+
+void pll(unsigned long long x)
+{
+ printf("%llx\n", x);
+}
+
+void movi(void)
+{
+ printf("MOVI:\n");
+ pll(0);
+ pll(0xabcd);
+ pll(0xabcd0000);
+ pll(0xabcd00000000);
+ pll(0xabcd000000000000);
+ pll(0xffffabcd);
+ pll(0xabcdffff);
+ pll(0xffffffffffffabcd);
+ pll(0xffffffffabcdffff);
+ pll(0xffffabcdffffffff);
+ pll(0xabcdffffffffffff);
+ pll(0xaaaaaaaa);
+ pll(0x5555555555555555);
+ pll(0x77777777);
+ pll(0x3333333333333333);
+ pll(0xf8f8f8f8);
+ pll(0x1e1e1e1e1e1e1e1e);
+ pll(0x3f803f80);
+ pll(0x01ff01ff01ff01ff);
+ pll(0x007fffc0);
+ pll(0x03fff80003fff800);
+ pll(0x0007fffffffffe00);
+
+ pll(0xabcd1234);
+ pll(0xabcd00001234);
+ pll(0xabcd000000001234);
+ pll(0xabcd12340000);
+ pll(0xabcd000012340000);
+ pll(0xabcd123400000000);
+ pll(0xffffffffabcd1234);
+ pll(0xffffabcdffff1234);
+ pll(0xabcdffffffff1234);
+ pll(0xffffabcd1234ffff);
+ pll(0xabcdffff1234ffff);
+ pll(0xabcd1234ffffffff);
+
+ pll(0xffffef0123456789);
+ pll(0xabcdef012345ffff);
+
+ pll(0xabcdef0123456789);
+}
+
+static uint32_t addip0(uint32_t x) { return x + 0; }
+static uint64_t sublp0(uint64_t x) { return x - 0; }
+static uint32_t addip123(uint32_t x) { return x + 123; }
+static uint64_t addlm123(uint64_t x) { return x + -123; }
+static uint64_t sublp4095(uint64_t x) { return x - 4095; }
+static uint32_t subim503808(uint32_t x) { return x - -503808; }
+static uint64_t addp12345(uint64_t x) { return x + 12345; }
+static uint32_t subp12345(uint32_t x) { return x - 12345; }
+
+static uint32_t mvni(uint32_t x) { return 0xffffffff - x; }
+static uint64_t negl(uint64_t x) { return 0 - x; }
+static uint32_t rsbi123(uint32_t x) { return 123 - x; }
+static uint64_t rsbl123(uint64_t x) { return 123 - x; }
+
+static uint32_t andi0(uint32_t x) { return x & 0; }
+static uint64_t andlm1(uint64_t x) { return x & -1; }
+static uint64_t orrl0(uint64_t x) { return x | 0; }
+static uint32_t orrim1(uint32_t x) { return x | -1; }
+static uint32_t eori0(uint32_t x) { return x ^ 0; }
+static uint64_t eorlm1(uint64_t x) { return x ^ -1; }
+static uint32_t and0xf0(uint32_t x) { return x & 0xf0; }
+static uint64_t orr0xf0(uint64_t x) { return x | 0xf0; }
+static uint64_t eor0xf0(uint64_t x) { return x ^ 0xf0; }
+
+static uint32_t lsli0(uint32_t x) { return x << 0; }
+static uint32_t lsri0(uint32_t x) { return x >> 0; }
+static int64_t asrl0(int64_t x) { return x >> 0; }
+static uint32_t lsli1(uint32_t x) { return x << 1; }
+static uint32_t lsli31(uint32_t x) { return x << 31; }
+static uint64_t lsll1(uint64_t x) { return x << 1; }
+static uint64_t lsll63(uint64_t x) { return x << 63; }
+static uint32_t lsri1(uint32_t x) { return x >> 1; }
+static uint32_t lsri31(uint32_t x) { return x >> 31; }
+static uint64_t lsrl1(uint64_t x) { return x >> 1; }
+static uint64_t lsrl63(uint64_t x) { return x >> 63; }
+static int32_t asri1(int32_t x) { return x >> 1; }
+static int32_t asri31(int32_t x) { return x >> 31; }
+static int64_t asrl1(int64_t x) { return x >> 1; }
+static int64_t asrl63(int64_t x) { return x >> 63; }
+
+void opi(void)
+{
+ int x = 1000;
+ pll(addip0(x));
+ pll(sublp0(x));
+ pll(addip123(x));
+ pll(addlm123(x));
+ pll(sublp4095(x));
+ pll(subim503808(x));
+ pll(addp12345(x));
+ pll(subp12345(x));
+ pll(mvni(x));
+ pll(negl(x));
+ pll(rsbi123(x));
+ pll(rsbl123(x));
+ pll(andi0(x));
+ pll(andlm1(x));
+ pll(orrl0(x));
+ pll(orrim1(x));
+ pll(eori0(x));
+ pll(eorlm1(x));
+ pll(and0xf0(x));
+ pll(orr0xf0(x));
+ pll(eor0xf0(x));
+ pll(lsli0(x));
+ pll(lsri0(x));
+ pll(asrl0(x));
+ pll(lsli1(x));
+ pll(lsli31(x));
+ pll(lsll1(x));
+ pll(lsll63(x));
+ pll(lsri1(x));
+ pll(lsri31(x));
+ pll(lsrl1(x));
+ pll(lsrl63(x));
+ pll(asri1(x));
+ pll(asri31(x));
+ pll(asrl1(x));
+ pll(asrl63(x));
+}
+
+void pcs(void)
+{
+ arg();
+ ret();
+ stdarg();
+ movi();
+ opi();
+}
+
+int main()
+{
+ pcs();
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/73_arm64.expect b/05/tcc-0.9.27/tests/tests2/73_arm64.expect
new file mode 100644
index 0000000..7bdebd3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/73_arm64.expect
@@ -0,0 +1,174 @@
+Arguments:
+0
+12
+345
+6789
+abcde
+fghijk
+lmnopqr
+stuvwxyz
+ABCDEFGHI
+JKLMNOPQRS
+TUVWXYZ0123
+456789abcdef
+ghijklmnopqrs
+tuvwxyzABCDEFG
+HIJKLMNOPQRSTUV
+WXYZ0123456789ab
+cdefghijklmnopqrs
+11.1
+12.1 12.1
+13.1 13.2 13.3
+14.1 14.2 14.3 14.4
+21.1
+22.1 22.1
+23.1 23.2 23.3
+24.1 24.2 24.3 24.4
+31.1
+32.1 32.1
+33.1 33.2 33.3
+34.1 34.2 34.3 34.4
+stu ABC JKL TUV 456 ghi
+ABC JKL TUV 456 ghi tuv
+14.1 14.4 23.1 23.3 32.1 32.2
+0 14.1 14.4 12 24.1 24.4 345 34.1 34.4
+Return values:
+0
+12
+345
+6789
+abcde
+fghijk
+lmnopqr
+stuvwxyz
+ABCDEFGHI
+JKLMNOPQRS
+TUVWXYZ0123
+456789abcdef
+ghijklmnopqrs
+tuvwxyzABCDEFG
+HIJKLMNOPQRSTUV
+WXYZ0123456789ab
+cdefghijklmnopqrs
+11.1
+12.1 12.2
+13.1 13.3
+14.1 14.4
+21.1
+22.1 22.2
+23.1 23.3
+24.1 24.4
+31.1
+32.1 32.2
+33.1 33.3
+34.1 34.4
+stdarg:
+ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI
+lmnopqr ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI
+HFA long double:
+34.1,34.4 34.1,34.4 34.1,34.4 34.1,34.4
+33.1,33.3 34.1,34.4 34.1,34.4 34.1,34.4
+32.1,32.2 34.1,34.4 34.1,34.4 34.1,34.4
+31.1,31.1 34.1,34.4 34.1,34.4 34.1,34.4
+32.1,32.2 33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
+31.1,31.1 33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
+33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
+34.1,34.4 32.1,32.2 32.1,32.2 32.1,32.2 32.1,32.2
+33.1,33.3 32.1,32.2 32.1,32.2 32.1,32.2 32.1,32.2
+34.1,34.4 32.1,32.2 31.1,31.1 31.1,31.1 31.1,31.1 31.1,31.1
+HFA double:
+24.1,24.4 24.1,24.4 24.1,24.4 24.1,24.4
+23.1,23.3 24.1,24.4 24.1,24.4 24.1,24.4
+22.1,22.2 24.1,24.4 24.1,24.4 24.1,24.4
+21.1,21.1 24.1,24.4 24.1,24.4 24.1,24.4
+22.1,22.2 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
+21.1,21.1 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
+23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
+24.1,24.4 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
+23.1,23.3 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
+24.1,24.4 22.1,22.2 21.1,21.1 21.1,21.1 21.1,21.1 21.1,21.1
+HFA float:
+14.1,14.4 14.1,14.4 14.1,14.4 14.1,14.4
+13.1,13.3 14.1,14.4 14.1,14.4 14.1,14.4
+12.1,12.2 14.1,14.4 14.1,14.4 14.1,14.4
+11.1,11.1 14.1,14.4 14.1,14.4 14.1,14.4
+12.1,12.2 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
+11.1,11.1 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
+13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
+14.1,14.4 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
+13.1,13.3 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
+14.1,14.4 12.1,12.2 11.1,11.1 11.1,11.1 11.1,11.1 11.1,11.1
+MOVI:
+0
+abcd
+abcd0000
+abcd00000000
+abcd000000000000
+ffffabcd
+abcdffff
+ffffffffffffabcd
+ffffffffabcdffff
+ffffabcdffffffff
+abcdffffffffffff
+aaaaaaaa
+5555555555555555
+77777777
+3333333333333333
+f8f8f8f8
+1e1e1e1e1e1e1e1e
+3f803f80
+1ff01ff01ff01ff
+7fffc0
+3fff80003fff800
+7fffffffffe00
+abcd1234
+abcd00001234
+abcd000000001234
+abcd12340000
+abcd000012340000
+abcd123400000000
+ffffffffabcd1234
+ffffabcdffff1234
+abcdffffffff1234
+ffffabcd1234ffff
+abcdffff1234ffff
+abcd1234ffffffff
+ffffef0123456789
+abcdef012345ffff
+abcdef0123456789
+3e8
+3e8
+463
+36d
+fffffffffffff3e9
+7b3e8
+3421
+ffffd3af
+fffffc17
+fffffffffffffc18
+fffffc93
+fffffffffffffc93
+0
+3e8
+3e8
+ffffffff
+3e8
+fffffffffffffc17
+e0
+3f8
+318
+3e8
+3e8
+3e8
+7d0
+0
+7d0
+0
+1f4
+0
+1f4
+0
+1f4
+0
+1f4
+0
diff --git a/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.c b/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.c
new file mode 100644
index 0000000..234e3c4
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.c
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+/* This test is a snippet from the J interpreter */
+
+typedef long I;
+typedef struct{I c[4];I b,e,k;} PT;
+
+PT cases[] = {
+ ((I)4194304L +(I)2097152L +(I)67108864L), (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), -1L, 1,2,1,
+ ((I)+4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L, (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 2,3,2,
+ ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 1,3,2,
+ ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)524288L, -1L, 1,2,1,
+ ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)1048576L, (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 1,3,1,
+ ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)262144L, (I)262144L, 1,3,1,
+ ((I)4194304L +(I)2097152L +(I)67108864L), ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), -1L, 1,2,1,
+ (I)33554432L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)2097152L, ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), -1L, 0,2,1,
+ (I)67108864L, ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)134217728L, -1L, 0,2,0,
+};
+
+int main() {
+ int i, j;
+
+ for(j=0; j < sizeof(cases)/sizeof(cases[0]); j++) {
+ for(i=0; i < sizeof(cases->c)/sizeof(cases->c[0]); i++)
+ printf("cases[%d].c[%d]=%ld\n", j, i, cases[j].c[i]);
+
+ printf("cases[%d].b=%ld\n", j, cases[j].b);
+ printf("cases[%d].e=%ld\n", j, cases[j].e);
+ printf("cases[%d].k=%ld\n", j, cases[j].k);
+ printf("\n");
+ }
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.expect b/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.expect
new file mode 100644
index 0000000..2b75aa5
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/75_array_in_struct_init.expect
@@ -0,0 +1,72 @@
+cases[0].c[0]=73400320
+cases[0].c[1]=262144
+cases[0].c[2]=805567999
+cases[0].c[3]=-1
+cases[0].b=1
+cases[0].e=2
+cases[0].k=1
+
+cases[1].c[0]=879754751
+cases[1].c[1]=262144
+cases[1].c[2]=262144
+cases[1].c[3]=805567999
+cases[1].b=2
+cases[1].e=3
+cases[1].k=2
+
+cases[2].c[0]=879754751
+cases[2].c[1]=805567999
+cases[2].c[2]=262144
+cases[2].c[3]=805567999
+cases[2].b=1
+cases[2].e=3
+cases[2].k=2
+
+cases[3].c[0]=879754751
+cases[3].c[1]=805830143
+cases[3].c[2]=524288
+cases[3].c[3]=-1
+cases[3].b=1
+cases[3].e=2
+cases[3].k=1
+
+cases[4].c[0]=879754751
+cases[4].c[1]=805830143
+cases[4].c[2]=1048576
+cases[4].c[3]=805830143
+cases[4].b=1
+cases[4].e=3
+cases[4].k=1
+
+cases[5].c[0]=879754751
+cases[5].c[1]=805830143
+cases[5].c[2]=262144
+cases[5].c[3]=262144
+cases[5].b=1
+cases[5].e=3
+cases[5].k=1
+
+cases[6].c[0]=73400320
+cases[6].c[1]=807403007
+cases[6].c[2]=807403007
+cases[6].c[3]=-1
+cases[6].b=1
+cases[6].e=2
+cases[6].k=1
+
+cases[7].c[0]=839122431
+cases[7].c[1]=2097152
+cases[7].c[2]=807403007
+cases[7].c[3]=-1
+cases[7].b=0
+cases[7].e=2
+cases[7].k=1
+
+cases[8].c[0]=67108864
+cases[8].c[1]=807403007
+cases[8].c[2]=134217728
+cases[8].c[3]=-1
+cases[8].b=0
+cases[8].e=2
+cases[8].k=0
+
diff --git a/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.c b/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.c
new file mode 100644
index 0000000..c5fcf99
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+
+#define $(x) x
+#define $fred 10
+#define joe$ 20
+#define hen$y 30
+
+#define $10(x) x*10
+#define _$10(x) x/10
+
+int main()
+{
+ printf("fred=%d\n", $fred);
+ printf("joe=%d\n", joe$);
+ printf("henry=%d\n", hen$y);
+
+ printf("fred2=%d\n", $($fred));
+ printf("joe2=%d\n", $(joe$));
+ printf("henry2=%d\n", $(hen$y));
+
+ printf("fred10=%d\n", $10($fred));
+ printf("joe_10=%d\n", _$10(joe$));
+
+ int $ = 10;
+ int a100$ = 100;
+ int a$$ = 1000;
+ int a$c$b = 2121;
+ int $100 = 10000;
+ const char *$$$ = "money";
+
+ printf("local=%d\n", $);
+ printf("a100$=%d\n", a100$);
+ printf("a$$=%d\n", a$$);
+ printf("a$c$b=%d\n", a$c$b);
+ printf("$100=%d\n", $100);
+ printf("$$$=%s", $$$);
+
+ return 0;
+}
+
+/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
diff --git a/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.expect b/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.expect
new file mode 100644
index 0000000..4a20a52
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/76_dollars_in_identifiers.expect
@@ -0,0 +1,14 @@
+fred=10
+joe=20
+henry=30
+fred2=10
+joe2=20
+henry2=30
+fred10=100
+joe_10=2
+local=10
+a100$=100
+a$$=1000
+a$c$b=2121
+$100=10000
+$$$=money
diff --git a/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.c b/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.c
new file mode 100644
index 0000000..d38e0bf
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+int main()
+{
+ /* must not affect how #pragma ppop_macro works */
+ #define pop_macro foobar1
+
+ /* must not affect how #pragma push_macro works */
+ #define push_macro foobar2
+
+ #undef abort
+ #define abort "111"
+ printf("abort = %s\n", abort);
+
+ #pragma push_macro("abort")
+ #undef abort
+ #define abort "222"
+ printf("abort = %s\n", abort);
+
+ #pragma push_macro("abort")
+ #undef abort
+ #define abort "333"
+ printf("abort = %s\n", abort);
+
+ #pragma pop_macro("abort")
+ printf("abort = %s\n", abort);
+
+ #pragma pop_macro("abort")
+ printf("abort = %s\n", abort);
+}
diff --git a/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.expect b/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.expect
new file mode 100644
index 0000000..d8a5530
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/77_push_pop_macro.expect
@@ -0,0 +1,5 @@
+abort = 111
+abort = 222
+abort = 333
+abort = 222
+abort = 111
diff --git a/05/tcc-0.9.27/tests/tests2/78_vla_label.c b/05/tcc-0.9.27/tests/tests2/78_vla_label.c
new file mode 100644
index 0000000..4096495
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/78_vla_label.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+
+/* This test segfaults as of April 27, 2015. */
+void f1(int argc)
+{
+ char test[argc];
+ if(0)
+ label:
+ printf("boom!\n");
+ if(argc-- == 0)
+ return;
+ goto label;
+}
+
+/* This segfaulted on 2015-11-19. */
+void f2(void)
+{
+ goto start;
+ {
+ int a[1 && 1]; /* not a variable-length array */
+ int b[1 || 1]; /* not a variable-length array */
+ int c[1 ? 1 : 1]; /* not a variable-length array */
+ start:
+ a[0] = 0;
+ b[0] = 0;
+ c[0] = 0;
+ }
+}
+
+void f3(void)
+{
+ printf("%d\n", 0 ? printf("x1\n") : 11);
+ printf("%d\n", 1 ? 12 : printf("x2\n"));
+ printf("%d\n", 0 && printf("x3\n"));
+ printf("%d\n", 1 || printf("x4\n"));
+}
+
+int main()
+{
+ f1(2);
+ f2();
+ f3();
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/78_vla_label.expect b/05/tcc-0.9.27/tests/tests2/78_vla_label.expect
new file mode 100644
index 0000000..3f4063b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/78_vla_label.expect
@@ -0,0 +1,6 @@
+boom!
+boom!
+11
+12
+0
+1
diff --git a/05/tcc-0.9.27/tests/tests2/79_vla_continue.c b/05/tcc-0.9.27/tests/tests2/79_vla_continue.c
new file mode 100644
index 0000000..91215c9
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/79_vla_continue.c
@@ -0,0 +1,116 @@
+#include <stdio.h>
+
+int f(void)
+{
+ return 5;
+}
+
+void test1()
+{
+ int count = 10;
+ void *addr[10];
+ for(;count--;) {
+ int a[f()];
+
+ addr[count] = a;
+
+ continue;
+ }
+
+ if(addr[9] == addr[0]) {
+ printf("OK\n");
+ } else {
+ printf("NOT OK\n");
+ }
+}
+
+void test2()
+{
+ int count = 10;
+ void *addr[count];
+ for(;count--;) {
+ int a[f()];
+
+ addr[count] = a;
+
+ continue;
+ }
+
+ if(addr[9] == addr[0]) {
+ printf("OK\n");
+ } else {
+ printf("NOT OK\n");
+ }
+}
+
+void test3()
+{
+ int count = 10;
+ void *addr[count];
+ while(count--) {
+ int a[f()];
+
+ addr[count] = a;
+
+ continue;
+ }
+
+ if(addr[9] == addr[0]) {
+ printf("OK\n");
+ } else {
+ printf("NOT OK\n");
+ }
+}
+
+void test4()
+{
+ int count = 10;
+ void *addr[count];
+ do {
+ int a[f()];
+
+ addr[--count] = a;
+
+ continue;
+ } while (count);
+
+ if(addr[9] == addr[0]) {
+ printf("OK\n");
+ } else {
+ printf("NOT OK\n");
+ }
+}
+
+void test5()
+{
+ int count = 10;
+ int a[f()];
+ int c[f()];
+
+ c[0] = 42;
+
+ for(;count--;) {
+ int b[f()];
+ int i;
+ for (i=0; i<f(); i++) {
+ b[i] = count;
+ }
+ }
+
+ if (c[0] == 42) {
+ printf("OK\n");
+ } else {
+ printf("NOT OK\n");
+ }
+}
+
+int main(void)
+{
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/79_vla_continue.expect b/05/tcc-0.9.27/tests/tests2/79_vla_continue.expect
new file mode 100644
index 0000000..21da4d2
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/79_vla_continue.expect
@@ -0,0 +1,5 @@
+OK
+OK
+OK
+OK
+OK
diff --git a/05/tcc-0.9.27/tests/tests2/80_flexarray.c b/05/tcc-0.9.27/tests/tests2/80_flexarray.c
new file mode 100644
index 0000000..1fc1a60
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/80_flexarray.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+struct wchar {
+ char *data; char mem[];
+};
+struct wint {
+ char *data; int mem[];
+};
+int f1char (void) {
+ char s[9]="nonono";
+ struct wchar q = {"bugs"};
+ return !s[0];
+}
+int f1int (void) {
+ char s[9]="nonono";
+ struct wint q = {"bugs"};
+ return !s[0];
+}
+int main (void) {
+ char s[9]="nonono";
+ static struct wchar q = {"bugs", {'c'}};
+ //printf ("tcc has %s %s\n", s, q.data);
+ if (f1char() || f1int())
+ printf ("bla\n");
+ return !s[0];
+}
diff --git a/05/tcc-0.9.27/tests/tests2/80_flexarray.expect b/05/tcc-0.9.27/tests/tests2/80_flexarray.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/80_flexarray.expect
diff --git a/05/tcc-0.9.27/tests/tests2/81_types.c b/05/tcc-0.9.27/tests/tests2/81_types.c
new file mode 100644
index 0000000..fd6d71b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/81_types.c
@@ -0,0 +1,43 @@
+/* The following are all valid decls, even though some subtypes
+ are incomplete. */
+enum E *e;
+const enum E *e1;
+enum E const *e2;
+struct S *s;
+const struct S *s1;
+struct S const *s2;
+
+/* Various strangely looking declarators, which are all valid
+ and have to map to the same numbered typedefs. */
+typedef int (*fptr1)();
+int f1 (int (), int);
+typedef int (*fptr2)(int x);
+int f2 (int (int x), int);
+typedef int (*fptr3)(int);
+int f3 (int (int), int);
+typedef int (*fptr4[4])(int);
+int f4 (int (*[4])(int), int);
+typedef int (*fptr5)(fptr1);
+int f5 (int (int()), fptr1);
+int f1 (fptr1 fp, int i)
+{
+ return (*fp)(i);
+}
+int f2 (fptr2 fp, int i)
+{
+ return (*fp)(i);
+}
+int f3 (fptr3 fp, int i)
+{
+ return (*fp)(i);
+}
+int f4 (fptr4 fp, int i)
+{
+ return (*fp[i])(i);
+}
+int f5 (fptr5 fp, fptr1 i)
+{
+ return fp(i);
+}
+int f8 (int ([4]), int);
+int main () { return 0; }
diff --git a/05/tcc-0.9.27/tests/tests2/81_types.expect b/05/tcc-0.9.27/tests/tests2/81_types.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/81_types.expect
diff --git a/05/tcc-0.9.27/tests/tests2/82_attribs_position.c b/05/tcc-0.9.27/tests/tests2/82_attribs_position.c
new file mode 100644
index 0000000..7c9f987
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/82_attribs_position.c
@@ -0,0 +1,19 @@
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+
+typedef union Unaligned16a {
+ uint16_t u;
+ uint8_t b[2];
+} __attribute__((packed)) Unaligned16a;
+
+typedef union __attribute__((packed)) Unaligned16b {
+ uint16_t u;
+ uint8_t b[2];
+} Unaligned16b;
+
+extern void foo (void) __attribute__((stdcall));
+void __attribute__((stdcall)) foo (void)
+{
+}
+
+int main () { return 0; }
diff --git a/05/tcc-0.9.27/tests/tests2/82_attribs_position.expect b/05/tcc-0.9.27/tests/tests2/82_attribs_position.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/82_attribs_position.expect
diff --git a/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.c b/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.c
new file mode 100644
index 0000000..1f86095
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+double привет=0.1;
+int Lefèvre=2;
+int main(){
+ printf("привет=%g\n",привет);
+ printf("Lefèvre=%d\n",Lefèvre);
+ return 0;
+}
+// pcc & tcc only
diff --git a/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.expect b/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.expect
new file mode 100644
index 0000000..1553f5f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/83_utf8_in_identifiers.expect
@@ -0,0 +1,2 @@
+привет=0.1
+Lefèvre=2
diff --git a/05/tcc-0.9.27/tests/tests2/84_hex-float.c b/05/tcc-0.9.27/tests/tests2/84_hex-float.c
new file mode 100644
index 0000000..0ef09bf
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/84_hex-float.c
@@ -0,0 +1,12 @@
+extern int printf(const char *format, ...);
+
+#define ACPI_TYPE_INVALID 0x1E
+#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
+int array[NUM_NS_TYPES];
+
+#define n 0xe
+int main()
+{
+ printf("n+1 = %d\n", n+1);
+// printf("n+1 = %d\n", 0xe+1);
+}
diff --git a/05/tcc-0.9.27/tests/tests2/84_hex-float.expect b/05/tcc-0.9.27/tests/tests2/84_hex-float.expect
new file mode 100644
index 0000000..2175385
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/84_hex-float.expect
@@ -0,0 +1 @@
+n+1 = 15
diff --git a/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.c b/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.c
new file mode 100644
index 0000000..dc5639a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.c
@@ -0,0 +1,9 @@
+extern int printf (const char *, ...);
+extern void vide(void);
+__asm__("vide: ret");
+
+int main() {
+ vide();
+ printf ("okay\n");
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.expect b/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.expect
new file mode 100644
index 0000000..dcf02b2
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/85_asm-outside-function.expect
@@ -0,0 +1 @@
+okay
diff --git a/05/tcc-0.9.27/tests/tests2/86_memory-model.c b/05/tcc-0.9.27/tests/tests2/86_memory-model.c
new file mode 100644
index 0000000..744c3e2
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/86_memory-model.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+
+int
+main()
+{
+#if defined(__LLP64__)
+ if (sizeof(short) == 2
+ && sizeof(int) == 4
+ && sizeof(long int) == 4
+ && sizeof(long long int) == 8
+ && sizeof(void*) == 8) {
+ (void)printf("Ok\n");
+ } else {
+ (void)printf("KO __LLP64__\n");
+ }
+#elif defined(__LP64__)
+ if (sizeof(short) == 2
+ && sizeof(int) == 4
+ && sizeof(long int) == 8
+ && sizeof(long long int) == 8
+ && sizeof(void*) == 8) {
+ (void)printf("Ok\n");
+ } else {
+ (void)printf("KO __LP64__\n");
+ }
+#elif defined(__ILP32__)
+ if (sizeof(short) == 2
+ && sizeof(int) == 4
+ && sizeof(long int) == 4
+ && sizeof(void*) == 4) {
+ (void)printf("Ok\n");
+ } else {
+ (void)printf("KO __ILP32__\n");
+ }
+#else
+ (void)printf("KO no __*LP*__ defined.\n");
+#endif
+}
diff --git a/05/tcc-0.9.27/tests/tests2/86_memory-model.expect b/05/tcc-0.9.27/tests/tests2/86_memory-model.expect
new file mode 100644
index 0000000..7326d96
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/86_memory-model.expect
@@ -0,0 +1 @@
+Ok
diff --git a/05/tcc-0.9.27/tests/tests2/87_dead_code.c b/05/tcc-0.9.27/tests/tests2/87_dead_code.c
new file mode 100644
index 0000000..98d4566
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/87_dead_code.c
@@ -0,0 +1,122 @@
+/* This checks various ways of dead code inside if statements
+ where there are non-obvious ways of how the code is actually
+ not dead due to reachable by labels. */
+extern int printf (const char *, ...);
+static void kb_wait_1(void)
+{
+ unsigned long timeout = 2;
+ do {
+ /* Here the else arm is a statement expression that's supposed
+ to be suppressed. The label inside the while would unsuppress
+ code generation again if not handled correctly. And that
+ would wreak havoc to the cond-expression because there's no
+ jump-around emitted, the whole statement expression really
+ needs to not generate code (perhaps except useless forward jumps). */
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ int i = 1;
+ while (1)
+ while (i--)
+ some_label:
+ printf("error\n");
+ goto some_label;
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+int main (void)
+{
+ int i = 1;
+ kb_wait_1();
+
+ /* Simple test of dead code at first sight which isn't actually dead. */
+ if (0) {
+yeah:
+ printf ("yeah\n");
+ } else {
+ printf ("boo\n");
+ }
+ if (i--)
+ goto yeah;
+
+ /* Some more non-obvious uses where the problems are loops, so that even
+ the first loop statements aren't actually dead. */
+ i = 1;
+ if (0) {
+ while (i--) {
+ printf ("once\n");
+enterloop:
+ printf ("twice\n");
+ }
+ }
+ if (i >= 0)
+ goto enterloop;
+
+ /* The same with statement expressions. One might be tempted to
+ handle them specially by counting if inside statement exprs and
+ not unsuppressing code at loops at all then.
+ See kb_wait_1 for the other side of the medal where that wouldn't work. */
+ i = ({
+ int j = 1;
+ if (0) {
+ while (j--) {
+ printf ("SEonce\n");
+ enterexprloop:
+ printf ("SEtwice\n");
+ }
+ }
+ if (j >= 0)
+ goto enterexprloop;
+ j; });
+
+ /* The other two loop forms: */
+ i = 1;
+ if (0) {
+ for (i = 1; i--;) {
+ printf ("once2\n");
+enterloop2:
+ printf ("twice2\n");
+ }
+ }
+ if (i > 0)
+ goto enterloop2;
+
+ i = 1;
+ if (0) {
+ do {
+ printf ("once3\n");
+enterloop3:
+ printf ("twice3\n");
+ } while (i--);
+ }
+ if (i > 0)
+ goto enterloop3;
+
+ /* And check that case and default labels have the same effect
+ of disabling code suppression. */
+ i = 41;
+ switch (i) {
+ if (0) {
+ printf ("error\n");
+ case 42:
+ printf ("error2\n");
+ case 41:
+ printf ("caseok\n");
+ }
+ }
+
+ i = 41;
+ switch (i) {
+ if (0) {
+ printf ("error3\n");
+ default:
+ printf ("caseok2\n");
+ break;
+ case 42:
+ printf ("error4\n");
+ }
+ }
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/87_dead_code.expect b/05/tcc-0.9.27/tests/tests2/87_dead_code.expect
new file mode 100644
index 0000000..0b3ec1d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/87_dead_code.expect
@@ -0,0 +1,18 @@
+timeout=2
+timeout=1
+boo
+yeah
+twice
+once
+twice
+SEtwice
+SEonce
+SEtwice
+twice2
+once2
+twice2
+twice3
+once3
+twice3
+caseok
+caseok2
diff --git a/05/tcc-0.9.27/tests/tests2/88_codeopt.c b/05/tcc-0.9.27/tests/tests2/88_codeopt.c
new file mode 100644
index 0000000..647626f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/88_codeopt.c
@@ -0,0 +1,68 @@
+/* Check some way in where code suppression caused various
+ miscompilations. */
+extern int printf (const char *, ...);
+typedef unsigned long size_t;
+
+size_t _brk_start, _brk_end;
+void * extend_brk(size_t size, size_t align)
+{
+ size_t mask = align - 1;
+ void *ret = 0;
+
+ do {
+ if (__builtin_expect(!!(_brk_start == 0), 0))
+ do {
+ printf("wrong1\n");
+ } while (0);
+ } while (0);
+ _brk_end = (_brk_end + mask) & ~mask;
+ ret = (void *)_brk_end;
+ _brk_end += size;
+
+ return ret;
+}
+
+static void get_args (int a, int b)
+{
+ if (a != 1)
+ printf("wrong2\n");
+ else
+ printf("okay\n");
+}
+
+void bla(void)
+{
+ int __ret = 42;
+ ({
+ if (__builtin_expect(!!(0), 0)) {
+ if (__builtin_expect(!!__ret, 0))
+ printf("wrong3\n");
+ int x = !!(__ret);
+ }
+ __ret;
+ });
+ get_args(!!__ret, sizeof(__ret));
+}
+
+_Bool chk(unsigned long addr, unsigned long limit, unsigned long size)
+{
+ _Bool ret;
+ /* This just needs to compile, no runtime test. (And it doesn't compile
+ only with certain internal checking added that's not committed). */
+ if (0)
+ ret = 0 != (!!(addr > limit - size));
+}
+
+int main()
+{
+ void *r;
+ _brk_start = 1024;
+ _brk_end = 1024;
+ r = extend_brk (4096, 16);
+ if (!r)
+ printf("wrong4\n");
+ else
+ printf("okay\n");
+ bla();
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/88_codeopt.expect b/05/tcc-0.9.27/tests/tests2/88_codeopt.expect
new file mode 100644
index 0000000..439edfd
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/88_codeopt.expect
@@ -0,0 +1,2 @@
+okay
+okay
diff --git a/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.c b/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.c
new file mode 100644
index 0000000..73e0a4b
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.c
@@ -0,0 +1,112 @@
+extern int printf(const char *format, ...);
+static void kb_wait_1(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ while (1)
+ printf("error\n");
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+static void kb_wait_2(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ for (;;)
+ printf("error\n");
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+static void kb_wait_2_1(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ do {
+ printf("error\n");
+ } while (1);
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+static void kb_wait_2_2(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ label:
+ printf("error\n");
+ goto label;
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+static void kb_wait_3(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ int i = 1;
+ goto label;
+ i = i + 2;
+ label:
+ i = i + 3;
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+static void kb_wait_4(void)
+{
+ unsigned long timeout = 2;
+ do {
+ (1 ?
+ printf("timeout=%ld\n", timeout) :
+ ({
+ switch(timeout) {
+ case 2:
+ printf("timeout is 2");
+ break;
+ case 1:
+ printf("timeout is 1");
+ break;
+ default:
+ printf("timeout is 0?");
+ break;
+ };
+ // return;
+ })
+ );
+ timeout--;
+ } while (timeout);
+}
+int main()
+{
+ printf("begin\n");
+ kb_wait_1();
+ kb_wait_2();
+ kb_wait_2_1();
+ kb_wait_2_2();
+ kb_wait_3();
+ kb_wait_4();
+ printf("end\n");
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.expect b/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.expect
new file mode 100644
index 0000000..c44d4ea
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/89_nocode_wanted.expect
@@ -0,0 +1,14 @@
+begin
+timeout=2
+timeout=1
+timeout=2
+timeout=1
+timeout=2
+timeout=1
+timeout=2
+timeout=1
+timeout=2
+timeout=1
+timeout=2
+timeout=1
+end
diff --git a/05/tcc-0.9.27/tests/tests2/90_struct-init.c b/05/tcc-0.9.27/tests/tests2/90_struct-init.c
new file mode 100644
index 0000000..d931e23
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/90_struct-init.c
@@ -0,0 +1,282 @@
+typedef unsigned char u8;
+typedef struct {} empty_s;
+struct contains_empty {
+ u8 a;
+ empty_s empty;
+ u8 b;
+};
+struct contains_empty ce = { { (1) }, (empty_s){}, 022, };
+/* The following decl of 'q' would demonstrate the TCC bug in init_putv when
+ handling copying compound literals. (Compound literals
+ aren't acceptable constant initializers in isoc99, but
+ we accept them like gcc, except for this case)
+//char *q = (char *){ "trara" }; */
+struct SS {u8 a[3], b; };
+struct SS sinit16[] = { { 1 }, 2 };
+struct S
+{
+ u8 a,b;
+ u8 c[2];
+};
+
+struct T
+{
+ u8 s[16];
+ u8 a;
+};
+
+struct U
+{
+ u8 a;
+ struct S s;
+ u8 b;
+ struct T t;
+};
+
+struct V
+{
+ struct S s;
+ struct T t;
+ u8 a;
+};
+
+struct W
+{
+ struct V t;
+ struct S s[];
+};
+
+struct S gs = ((struct S){1, 2, 3, 4});
+struct S gs2 = {1, 2, {3, 4}};
+struct T gt = {"hello", 42};
+struct U gu = {3, 5,6,7,8, 4, "huhu", 43};
+struct U gu2 = {3, {5,6,7,8}, 4, {"huhu", 43}};
+/* Optional braces around scalar initializers. Accepted, but with
+ a warning. */
+struct U gu3 = { {3}, {5,6,7,8,}, 4, {"huhu", 43}};
+/* Many superfluous braces and leaving out one initializer for U.s.c[1] */
+struct U gu4 = { 3, {5,6,7,}, 5, { "bla", {44}} };
+/* Superfluous braces and useless parens around values */
+struct S gs3 = { (1), {(2)}, {(((3))), {4}}};
+/* Superfluous braces, and leaving out braces for V.t, plus cast */
+struct V gv = {{{3},4,{5,6}}, "haha", (u8)45, 46};
+/* Compound literal */
+struct V gv2 = {(struct S){7,8,{9,10}}, {"hihi", 47}, 48};
+/* Parens around compound literal */
+struct V gv3 = {((struct S){7,8,{9,10}}), {"hoho", 49}, 50};
+/* Initialization of a flex array member (warns in GCC) */
+struct W gw = {{1,2,3,4}, {1,2,3,4,5}};
+
+union UU {
+ u8 a;
+ u8 b;
+};
+struct SU {
+ union UU u;
+ u8 c;
+};
+struct SU gsu = {5,6};
+
+/* Unnamed struct/union members aren't ISO C, but it's a widely accepted
+ extension. See below for further extensions to that under -fms-extension.*/
+union UV {
+ struct {u8 a,b;};
+ struct S s;
+};
+union UV guv = {{6,5}};
+union UV guv2 = {{.b = 7, .a = 8}};
+union UV guv3 = {.b = 8, .a = 7};
+
+/* Under -fms-extensions also the following is valid:
+union UV2 {
+ struct Anon {u8 a,b;}; // unnamed member, but tagged struct, ...
+ struct S s;
+};
+struct Anon gan = { 10, 11 }; // ... which makes it available here.
+union UV2 guv4 = {{4,3}}; // and the other inits from above as well
+*/
+
+struct in6_addr {
+ union {
+ u8 u6_addr8[16];
+ unsigned short u6_addr16[8];
+ } u;
+};
+struct flowi6 {
+ struct in6_addr saddr, daddr;
+};
+struct pkthdr {
+ struct in6_addr daddr, saddr;
+};
+struct pkthdr phdr = { { { 6,5,4,3 } }, { { 9,8,7,6 } } };
+
+struct Wrap {
+ void *func;
+};
+int global;
+void inc_global (void)
+{
+ global++;
+}
+
+struct Wrap global_wrap[] = {
+ ((struct Wrap) {inc_global}),
+ inc_global,
+};
+
+#include <stdio.h>
+void print_ (const char *name, const u8 *p, long size)
+{
+ printf ("%s:", name);
+ while (size--) {
+ printf (" %x", *p++);
+ }
+ printf ("\n");
+}
+#define print(x) print_(#x, (u8*)&x, sizeof (x))
+#if 1
+void foo (struct W *w, struct pkthdr *phdr_)
+{
+ struct S ls = {1, 2, 3, 4};
+ struct S ls2 = {1, 2, {3, 4}};
+ struct T lt = {"hello", 42};
+ struct U lu = {3, 5,6,7,8, 4, "huhu", 43};
+ struct U lu1 = {3, ls, 4, {"huhu", 43}};
+ struct U lu2 = {3, (ls), 4, {"huhu", 43}};
+ const struct S *pls = &ls;
+ struct S ls21 = *pls;
+ struct U lu22 = {3, *pls, 4, {"huhu", 43}};
+ /* Incomplete bracing. */
+ struct U lu21 = {3, ls, 4, "huhu", 43};
+ /* Optional braces around scalar initializers. Accepted, but with
+ a warning. */
+ struct U lu3 = { 3, {5,6,7,8,}, 4, {"huhu", 43}};
+ /* Many superfluous braces and leaving out one initializer for U.s.c[1] */
+ struct U lu4 = { 3, {5,6,7,}, 5, { "bla", 44} };
+ /* Superfluous braces and useless parens around values */
+ struct S ls3 = { (1), (2), {(((3))), 4}};
+ /* Superfluous braces, and leaving out braces for V.t, plus cast */
+ struct V lv = {{3,4,{5,6}}, "haha", (u8)45, 46};
+ /* Compound literal */
+ struct V lv2 = {(struct S)w->t.s, {"hihi", 47}, 48};
+ /* Parens around compound literal */
+ struct V lv3 = {((struct S){7,8,{9,10}}), ((const struct W *)w)->t.t, 50};
+ const struct pkthdr *phdr = phdr_;
+ struct flowi6 flow = { .daddr = phdr->daddr, .saddr = phdr->saddr };
+ int elt = 0x42;
+ /* Range init, overlapping */
+ struct T lt2 = { { [1 ... 5] = 9, [6 ... 10] = elt, [4 ... 7] = elt+1 }, 1 };
+ print(ls);
+ print(ls2);
+ print(lt);
+ print(lu);
+ print(lu1);
+ print(lu2);
+ print(ls21);
+ print(lu21);
+ print(lu22);
+ print(lu3);
+ print(lu4);
+ print(ls3);
+ print(lv);
+ print(lv2);
+ print(lv3);
+ print(lt2);
+ print(flow);
+}
+#endif
+
+void test_compound_with_relocs (void)
+{
+ struct Wrap local_wrap[] = {
+ ((struct Wrap) {inc_global}),
+ inc_global,
+ };
+ void (*p)(void);
+ p = global_wrap[0].func; p();
+ p = global_wrap[1].func; p();
+ p = local_wrap[0].func; p();
+ p = local_wrap[1].func; p();
+}
+
+void sys_ni(void) { printf("ni\n"); }
+void sys_one(void) { printf("one\n"); }
+void sys_two(void) { printf("two\n"); }
+void sys_three(void) { printf("three\n"); }
+typedef void (*fptr)(void);
+const fptr table[3] = {
+ [0 ... 2] = &sys_ni,
+ [0] = sys_one,
+ [1] = sys_two,
+ [2] = sys_three,
+};
+
+void test_multi_relocs(void)
+{
+ int i;
+ for (i = 0; i < sizeof(table)/sizeof(table[0]); i++)
+ table[i]();
+}
+
+/* Following is from GCC gcc.c-torture/execute/20050613-1.c. */
+
+struct SEA { int i; int j; int k; int l; };
+struct SEB { struct SEA a; int r[1]; };
+struct SEC { struct SEA a; int r[0]; };
+struct SED { struct SEA a; int r[]; };
+
+static void
+test_correct_filling (struct SEA *x)
+{
+ static int i;
+ if (x->i != 0 || x->j != 5 || x->k != 0 || x->l != 0)
+ printf("sea_fill%d: wrong\n", i);
+ else
+ printf("sea_fill%d: okay\n", i);
+ i++;
+}
+
+int
+test_zero_init (void)
+{
+ /* The peculiarity here is that only a.j is initialized. That
+ means that all other members must be zero initialized. TCC
+ once didn't do that for sub-level designators. */
+ struct SEB b = { .a.j = 5 };
+ struct SEC c = { .a.j = 5 };
+ struct SED d = { .a.j = 5 };
+ test_correct_filling (&b.a);
+ test_correct_filling (&c.a);
+ test_correct_filling (&d.a);
+ return 0;
+}
+
+int main()
+{
+ print(ce);
+ print(gs);
+ print(gs2);
+ print(gt);
+ print(gu);
+ print(gu2);
+ print(gu3);
+ print(gu4);
+ print(gs3);
+ print(gv);
+ print(gv2);
+ print(gv3);
+ print(sinit16);
+ print(gw);
+ print(gsu);
+ print(guv);
+ print(guv.b);
+ print(guv2);
+ print(guv3);
+ print(phdr);
+ foo(&gw, &phdr);
+ //printf("q: %s\n", q);
+ test_compound_with_relocs();
+ test_multi_relocs();
+ test_zero_init();
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/90_struct-init.expect b/05/tcc-0.9.27/tests/tests2/90_struct-init.expect
new file mode 100644
index 0000000..e366121
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/90_struct-init.expect
@@ -0,0 +1,43 @@
+ce: 1 12
+gs: 1 2 3 4
+gs2: 1 2 3 4
+gt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a
+gu: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+gu2: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+gu3: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+gu4: 3 5 6 7 0 5 62 6c 61 0 0 0 0 0 0 0 0 0 0 0 0 0 2c
+gs3: 1 2 3 4
+gv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
+gv2: 7 8 9 a 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
+gv3: 7 8 9 a 68 6f 68 6f 0 0 0 0 0 0 0 0 0 0 0 0 31 32
+sinit16: 1 0 0 0 2 0 0 0
+gw: 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+gsu: 5 6
+guv: 6 5 0 0
+guv.b: 5
+guv2: 8 7 0 0
+guv3: 7 8 0 0
+phdr: 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 0 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0
+ls: 1 2 3 4
+ls2: 1 2 3 4
+lt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a
+lu: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+lu1: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+lu2: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+ls21: 1 2 3 4
+lu21: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+lu22: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+lu3: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
+lu4: 3 5 6 7 0 5 62 6c 61 0 0 0 0 0 0 0 0 0 0 0 0 0 2c
+ls3: 1 2 3 4
+lv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
+lv2: 1 2 3 4 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
+lv3: 7 8 9 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32
+lt2: 0 9 9 9 43 43 43 43 42 42 42 0 0 0 0 0 1
+flow: 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 0
+one
+two
+three
+sea_fill0: okay
+sea_fill1: okay
+sea_fill2: okay
diff --git a/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.c b/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.c
new file mode 100644
index 0000000..bf07915
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.c
@@ -0,0 +1,15 @@
+int printf(const char *, ...);
+char t[] = "012345678";
+
+int main(void)
+{
+ char *data = t;
+ unsigned long long r = 4;
+ unsigned a = 5;
+ unsigned long long b = 12;
+
+ *(unsigned*)(data + r) += a - b;
+
+ printf("data = \"%s\"\n", data);
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.expect b/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.expect
new file mode 100644
index 0000000..f91e4b4
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/91_ptr_longlong_arith32.expect
@@ -0,0 +1 @@
+data = "0123-5678"
diff --git a/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.c b/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.c
new file mode 100644
index 0000000..bb6dc35
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.c
@@ -0,0 +1,57 @@
+/* This checks if enums needing 8 bit but only having positive
+ values are correctly zero extended (instead of sign extended)
+ when stored into/loaded from a 8 bit bit-field of enum type (which
+ itself is implementation defined, so isn't necessarily supported by all
+ other compilers). */
+enum tree_code {
+ SOME_CODE = 148, /* has bit 7 set, and hence all further enum values as well */
+ LAST_AND_UNUSED_TREE_CODE
+};
+typedef union tree_node *tree;
+struct tree_common
+{
+ union tree_node *chain;
+ union tree_node *type;
+ enum tree_code code : 8;
+ unsigned side_effects_flag : 1;
+};
+union tree_node
+{
+ struct tree_common common;
+ };
+enum c_tree_code {
+ C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
+ STMT_EXPR,
+ LAST_C_TREE_CODE
+};
+enum cplus_tree_code {
+ CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
+ AMBIG_CONV,
+ LAST_CPLUS_TREE_CODE
+};
+
+extern int printf(const char *, ...);
+int blah(){return 0;}
+
+int convert_like_real (tree convs)
+{
+ switch (((enum tree_code) (convs)->common.code))
+ {
+ case AMBIG_CONV: /* This has bit 7 set, which must not be the sign
+ bit in tree_common.code, i.e. the bitfield must
+ be somehow marked unsigned. */
+ return blah();
+ default:
+ break;
+ };
+ printf("unsigned enum bit-fields broken\n");
+}
+
+int main()
+{
+ union tree_node convs;
+
+ convs.common.code = AMBIG_CONV;
+ convert_like_real (&convs);
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.expect b/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.expect
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/92_enum_bitfield.expect
diff --git a/05/tcc-0.9.27/tests/tests2/93_integer_promotion.c b/05/tcc-0.9.27/tests/tests2/93_integer_promotion.c
new file mode 100644
index 0000000..a1176fc
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/93_integer_promotion.c
@@ -0,0 +1,71 @@
+/* integer promotion */
+
+int printf(const char*, ...);
+#define promote(s) printf(" %ssigned : %s\n", (s) - 100 < 0 ? " " : "un", #s);
+
+int main (void)
+{
+ struct {
+ unsigned ub:3;
+ unsigned u:32;
+ unsigned long long ullb:35;
+ unsigned long long ull:64;
+ unsigned char c;
+ } s = { 1, 1, 1 };
+
+ promote(s.ub);
+ promote(s.u);
+ promote(s.ullb);
+ promote(s.ull);
+ promote(s.c);
+ printf("\n");
+
+ promote((1 ? s.ub : 1));
+ promote((1 ? s.u : 1));
+ promote((1 ? s.ullb : 1));
+ promote((1 ? s.ull : 1));
+ promote((1 ? s.c : 1));
+ printf("\n");
+
+ promote(s.ub << 1);
+ promote(s.u << 1);
+ promote(s.ullb << 1);
+ promote(s.ull << 1);
+ promote(s.c << 1);
+ printf("\n");
+
+ promote(+s.ub);
+ promote(+s.u);
+ promote(+s.ullb);
+ promote(+s.ull);
+ promote(+s.c);
+ printf("\n");
+
+ promote(-s.ub);
+ promote(-s.u);
+ promote(-s.ullb);
+ promote(-s.ull);
+ promote(-s.c);
+ printf("\n");
+
+ promote(~s.ub);
+ promote(~s.u);
+ promote(~s.ullb);
+ promote(~s.ull);
+ promote(~s.c);
+ printf("\n");
+
+ promote(!s.ub);
+ promote(!s.u);
+ promote(!s.ullb);
+ promote(!s.ull);
+ promote(!s.c);
+ printf("\n");
+
+ promote(+(unsigned)s.ub);
+ promote(-(unsigned)s.ub);
+ promote(~(unsigned)s.ub);
+ promote(!(unsigned)s.ub);
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/93_integer_promotion.expect b/05/tcc-0.9.27/tests/tests2/93_integer_promotion.expect
new file mode 100644
index 0000000..34b9c14
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/93_integer_promotion.expect
@@ -0,0 +1,46 @@
+ signed : s.ub
+ unsigned : s.u
+ signed : s.ullb
+ unsigned : s.ull
+ signed : s.c
+
+ signed : (1 ? s.ub : 1)
+ unsigned : (1 ? s.u : 1)
+ signed : (1 ? s.ullb : 1)
+ unsigned : (1 ? s.ull : 1)
+ signed : (1 ? s.c : 1)
+
+ signed : s.ub << 1
+ unsigned : s.u << 1
+ signed : s.ullb << 1
+ unsigned : s.ull << 1
+ signed : s.c << 1
+
+ signed : +s.ub
+ unsigned : +s.u
+ signed : +s.ullb
+ unsigned : +s.ull
+ signed : +s.c
+
+ signed : -s.ub
+ unsigned : -s.u
+ signed : -s.ullb
+ unsigned : -s.ull
+ signed : -s.c
+
+ signed : ~s.ub
+ unsigned : ~s.u
+ signed : ~s.ullb
+ unsigned : ~s.ull
+ signed : ~s.c
+
+ signed : !s.ub
+ signed : !s.u
+ signed : !s.ullb
+ signed : !s.ull
+ signed : !s.c
+
+ unsigned : +(unsigned)s.ub
+ unsigned : -(unsigned)s.ub
+ unsigned : ~(unsigned)s.ub
+ signed : !(unsigned)s.ub
diff --git a/05/tcc-0.9.27/tests/tests2/94_generic.c b/05/tcc-0.9.27/tests/tests2/94_generic.c
new file mode 100644
index 0000000..d7fb5fc
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/94_generic.c
@@ -0,0 +1,64 @@
+#include <stdio.h>
+
+const int a = 0;
+
+struct a {
+ int a;
+};
+
+struct b {
+ int a;
+};
+
+int a_f()
+{
+ return 20;
+}
+
+int b_f()
+{
+ return 10;
+}
+
+typedef int int_type1;
+
+#define gen_sw(a) _Generic(a, const char *: 1, default: 8, int: 123);
+
+int main()
+{
+ int i = 0;
+ signed long int l = 2;
+ struct b titi;
+ const int * const ptr;
+ const char *ti;
+ int_type1 i2;
+
+ i = _Generic(a, int: a_f, const int: b_f)();
+ printf("%d\n", i);
+ i = _Generic(a, int: a_f() / 2, const int: b_f() / 2);
+ printf("%d\n", i);
+ i = _Generic(ptr, int *:1, int * const:2, default:20);
+ printf("%d\n", i);
+ i = gen_sw(a);
+ printf("%d\n", i);
+ i = _Generic(titi, struct a:1, struct b:2, default:20);
+ printf("%d\n", i);
+ i = _Generic(i2, char: 1, int : 0);
+ printf("%d\n", i);
+ i = _Generic(a, char:1, int[4]:2, default:5);
+ printf("%d\n", i);
+ i = _Generic(17, int :1, int **:2);
+ printf("%d\n", i);
+ i = _Generic(17L, int :1, long :2, long long : 3);
+ printf("%d\n", i);
+ i = _Generic("17, io", char *: 3, const char *: 1);
+ printf("%d\n", i);
+ i = _Generic(ti, const unsigned char *:1, const char *:4, char *:3,
+ const signed char *:2);
+ printf("%d\n", i);
+ printf("%s\n", _Generic(i + 2L, long: "long", int: "int",
+ long long: "long long"));
+ i = _Generic(l, long: 1, int: 2);
+ printf("%d\n", i);
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/94_generic.expect b/05/tcc-0.9.27/tests/tests2/94_generic.expect
new file mode 100644
index 0000000..9aa9275
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/94_generic.expect
@@ -0,0 +1,13 @@
+20
+10
+20
+123
+2
+0
+5
+1
+2
+3
+4
+long
+1 \ No newline at end of file
diff --git a/05/tcc-0.9.27/tests/tests2/95_bitfields.c b/05/tcc-0.9.27/tests/tests2/95_bitfields.c
new file mode 100644
index 0000000..f025c57
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/95_bitfields.c
@@ -0,0 +1,218 @@
+/* ----------------------------------------------------------------------- */
+#if TEST == 1
+{
+ struct M P A __s
+ {
+ unsigned x : 12;
+ unsigned char y : 7;
+ unsigned z : 28;
+ unsigned a: 4;
+ unsigned b: 5;
+ };
+ TEST_STRUCT(0x333,0x44,0x555555,6,7);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif TEST == 2
+{
+ struct M P __s
+ {
+ int x: 12;
+ char y: 6;
+ long long z:63;
+ A char a:4;
+ long long b:2;
+
+ };
+ TEST_STRUCT(3,30,0x123456789abcdef0LL,5,2);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif TEST == 3
+{
+ struct M P __s
+ {
+ unsigned x:5, y:5, :0, z:5; char a:5; A short b:5;
+ };
+ TEST_STRUCT(21,23,25,6,14);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif TEST == 4
+{
+ struct M P __s {
+ int x : 3;
+ int : 2;
+ int y : 1;
+ int : 0;
+ int z : 5;
+ int a : 7;
+ unsigned int b : 7;
+ };
+ TEST_STRUCT(3,1,15,120,120);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif TEST == 5
+{
+ struct M P __s {
+ long long x : 45;
+ long long : 2;
+ long long y : 30;
+ unsigned long long z : 38;
+ char a; short b;
+ };
+ TEST_STRUCT(0x123456789ULL, 120<<25, 120, 0x44, 0x77);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif TEST == 6
+{
+ struct M P __s {
+ int a;
+ signed char b;
+ int x : 12, y : 4, : 0, : 4, z : 3;
+ char d;
+ };
+ TEST_STRUCT(1,2,3,4,-3);
+}
+
+/* ----------------------------------------------------------------------- */
+#elif defined PACK
+
+#if PACK
+# pragma pack(push,1)
+# define P //_P
+#else
+# define P
+#endif
+
+printf("\n\n" + 2*top);
+#define TEST 1
+#include SELF
+top = 0;
+#define TEST 2
+#include SELF
+#define TEST 3
+#include SELF
+#define TEST 4
+#include SELF
+#define TEST 5
+#include SELF
+#define TEST 6
+#include SELF
+
+#if PACK
+# pragma pack(pop)
+#endif
+
+#undef P
+#undef PACK
+
+/* ----------------------------------------------------------------------- */
+#elif defined ALIGN
+
+#if ALIGN
+# define A _A(16)
+#else
+# define A
+#endif
+
+#define PACK 0
+#include SELF
+#define PACK 1
+#include SELF
+
+#undef A
+#undef ALIGN
+
+/* ----------------------------------------------------------------------- */
+#elif defined MS_BF
+
+#if MS_BF
+# ifdef __TINYC__
+# pragma comment(option, "-mms-bitfields")
+# elif defined __GNUC__
+# define M __attribute__((ms_struct))
+# endif
+#else
+# ifdef __TINYC__
+# pragma comment(option, "-mno-ms-bitfields")
+# elif defined __GNUC__
+# define M __attribute__((gcc_struct))
+# endif
+#endif
+#ifndef M
+# define M
+#endif
+
+#define ALIGN 0
+#include SELF
+#define ALIGN 1
+#include SELF
+
+#undef M
+#undef MS_BF
+
+/* ----------------------------------------------------------------------- */
+#else
+
+#include <stdio.h>
+#include <string.h>
+/* some gcc headers #define __attribute__ to empty if it's not gcc */
+#undef __attribute__
+
+void dump(void *p, int s)
+{
+ int i;
+ for (i = s; --i >= 0;)
+ printf("%02X", ((unsigned char*)p)[i]);
+ printf("\n");
+}
+
+#define pv(m) \
+ printf(sizeof (s->m + 0) == 8 ? " %016llx" : " %02x", s->m)
+
+#define TEST_STRUCT(v1,v2,v3,v4,v5) { \
+ struct __s _s, *s = & _s; \
+ printf("\n---- TEST %d%s%s%s ----\n" + top, \
+ TEST, MS_BF?" - MS-BITFIELDS":"", \
+ PACK?" - PACKED":"", \
+ ALIGN?" - WITH ALIGN":""); \
+ memset(s, 0, sizeof *s); \
+ s->x = -1, s->y = -1, s->z = -1, s->a = -1, s->b = -1; \
+ printf("bits in use : "), dump(s, sizeof *s); \
+ s->x = v1, s->y = v2, s->z = v3, s->a += v4, ++s->a, s->b = v5; \
+ printf("bits as set : "), dump(s, sizeof *s); \
+ printf("values :"), pv(x), pv(y), pv(z), pv(a), pv(b), printf("\n"); \
+ printf("align/size : %d %d\n", alignof(struct __s),sizeof(struct __s)); \
+ }
+
+#ifdef _MSC_VER
+# define _A(n) __declspec(align(n))
+# define _P
+# define alignof(x) __alignof(x)
+#else
+# define _A(n) __attribute__((aligned(n)))
+# define _P __attribute__((packed))
+# define alignof(x) __alignof__(x)
+#endif
+
+#ifndef MS_BITFIELDS
+# define MS_BITFIELDS 0
+#endif
+
+#define SELF "95_bitfields.c"
+
+int top = 1;
+
+int main()
+{
+#define MS_BF MS_BITFIELDS
+#include SELF
+ return 0;
+}
+
+/* ----------------------------------------------------------------------- */
+#endif
+#undef TEST
diff --git a/05/tcc-0.9.27/tests/tests2/95_bitfields.expect b/05/tcc-0.9.27/tests/tests2/95_bitfields.expect
new file mode 100644
index 0000000..6a8fd9a
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/95_bitfields.expect
@@ -0,0 +1,149 @@
+---- TEST 1 ----
+bits in use : 0000001FFFFFFFFF007F0FFF
+bits as set : 000000076055555500440333
+values : 333 44 555555 06 07
+align/size : 4 12
+
+---- TEST 2 ----
+bits in use : 000000000000003F7FFFFFFFFFFFFFFF00000000003F0FFF
+bits as set : 0000000000000025123456789ABCDEF000000000001E0003
+values : 03 1e 123456789abcdef0 05 fffffffe
+align/size : 8 24
+
+---- TEST 3 ----
+bits in use : 001F1F1F000003FF
+bits as set : 000E0619000002F5
+values : 15 17 19 06 0e
+align/size : 4 8
+
+---- TEST 4 ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 4 8
+
+---- TEST 5 ----
+bits in use : FFFFFF3FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 007744000000007800000000300000000000000123456789
+values : 0000000123456789 f0000000 0000000000000078 44 77
+align/size : 8 24
+
+---- TEST 6 ----
+bits in use : 0000007000FFFFFFFFFFFFFF
+bits as set : 00000030002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 4 12
+
+
+
+---- TEST 1 - PACKED ----
+bits in use : FFFFFFFFFFFFFF
+bits as set : 3B02AAAAAC4333
+values : 333 44 555555 06 07
+align/size : 1 7
+
+---- TEST 2 - PACKED ----
+bits in use : 7FFFFFFFFFFFFFFFFFFFFF
+bits as set : 4A48D159E26AF37BC1E003
+values : 03 1e 123456789abcdef0 05 fffffffe
+align/size : 1 11
+
+---- TEST 3 - PACKED ----
+bits in use : 7FFF000003FF
+bits as set : 38D9000002F5
+values : 15 17 19 06 0e
+align/size : 1 6
+
+---- TEST 4 - PACKED ----
+bits in use : 07FFFF00000027
+bits as set : 078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 1 7
+
+---- TEST 5 - PACKED ----
+bits in use : FFFFFF07FFFFFFFFFFFFFFFF9FFFFFFFFFFF
+bits as set : 007744000000000F18000000000123456789
+values : 0000000123456789 f0000000 0000000000000078 44 77
+align/size : 1 18
+
+---- TEST 6 - PACKED ----
+bits in use : 007000FFFFFFFFFFFFFF
+bits as set : 0030002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 1 10
+
+
+
+---- TEST 1 - WITH ALIGN ----
+bits in use : 000000000000001FFFFFFFFF007F0FFF
+bits as set : 00000000000000076055555500440333
+values : 333 44 555555 06 07
+align/size : 16 16
+
+---- TEST 2 - WITH ALIGN ----
+bits in use : 0000000000000000000000000000003F7FFFFFFFFFFFFFFF00000000003F0FFF
+bits as set : 00000000000000000000000000000025123456789ABCDEF000000000001E0003
+values : 03 1e 123456789abcdef0 05 fffffffe
+align/size : 16 32
+
+---- TEST 3 - WITH ALIGN ----
+bits in use : 0000000000000000000000000000001F000000000000000000001F1F000003FF
+bits as set : 0000000000000000000000000000000E000000000000000000000619000002F5
+values : 15 17 19 06 0e
+align/size : 16 32
+
+---- TEST 4 - WITH ALIGN ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 4 8
+
+---- TEST 5 - WITH ALIGN ----
+bits in use : FFFFFF3FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 007744000000007800000000300000000000000123456789
+values : 0000000123456789 f0000000 0000000000000078 44 77
+align/size : 8 24
+
+---- TEST 6 - WITH ALIGN ----
+bits in use : 0000007000FFFFFFFFFFFFFF
+bits as set : 00000030002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 4 12
+
+
+
+---- TEST 1 - PACKED - WITH ALIGN ----
+bits in use : 000000000000000000FFFFFFFFFFFFFF
+bits as set : 0000000000000000003B02AAAAAC4333
+values : 333 44 555555 06 07
+align/size : 16 16
+
+---- TEST 2 - PACKED - WITH ALIGN ----
+bits in use : 3F01FFFFFFFFFFFFFFFFFFFF
+bits as set : 250048D159E26AF37BC1E003
+values : 03 1e 123456789abcdef0 05 fffffffe
+align/size : 1 12
+
+---- TEST 3 - PACKED - WITH ALIGN ----
+bits in use : 1F03FF000003FF
+bits as set : 0E00D9000002F5
+values : 15 17 19 06 0e
+align/size : 1 7
+
+---- TEST 4 - PACKED - WITH ALIGN ----
+bits in use : 07FFFF00000027
+bits as set : 078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 1 7
+
+---- TEST 5 - PACKED - WITH ALIGN ----
+bits in use : FFFFFF07FFFFFFFFFFFFFFFF9FFFFFFFFFFF
+bits as set : 007744000000000F18000000000123456789
+values : 0000000123456789 f0000000 0000000000000078 44 77
+align/size : 1 18
+
+---- TEST 6 - PACKED - WITH ALIGN ----
+bits in use : 007000FFFFFFFFFFFFFF
+bits as set : 0030002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 1 10
diff --git a/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.c b/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.c
new file mode 100644
index 0000000..b196fbd
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.c
@@ -0,0 +1,2 @@
+#define MS_BITFIELDS 1
+#include "95_bitfields.c"
diff --git a/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.expect b/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.expect
new file mode 100644
index 0000000..8ccafb7
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/95_bitfields_ms.expect
@@ -0,0 +1,149 @@
+---- TEST 1 - MS-BITFIELDS ----
+bits in use : 0000001FFFFFFFFF0000007F00000FFF
+bits as set : 00000007605555550000004400000333
+values : 333 44 555555 06 07
+align/size : 4 16
+
+---- TEST 2 - MS-BITFIELDS ----
+bits in use : 0000000000000003000000000000000F7FFFFFFFFFFFFFFF0000003F00000FFF
+bits as set : 00000000000000020000000000000005123456789ABCDEF00000001E00000003
+values : 03 1e 123456789abcdef0 05 fffffffffffffffe
+align/size : 8 32
+
+---- TEST 3 - MS-BITFIELDS ----
+bits in use : 001F001F0000001F000003FF
+bits as set : 000E000600000019000002F5
+values : 15 17 19 06 0e
+align/size : 4 12
+
+---- TEST 4 - MS-BITFIELDS ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 4 8
+
+---- TEST 5 - MS-BITFIELDS ----
+bits in use : 00000000FFFF00FF0000003FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 0000000000770044000000000000007800000000300000000000000123456789
+values : 0000000123456789 fffffffff0000000 0000000000000078 44 77
+align/size : 8 32
+
+---- TEST 6 - MS-BITFIELDS ----
+bits in use : 00000000000000700000FFFF000000FFFFFFFFFF
+bits as set : 000000000000003000002001000000FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 4 20
+
+
+
+---- TEST 1 - MS-BITFIELDS - PACKED ----
+bits in use : 0000001FFFFFFFFF7F00000FFF
+bits as set : 00000007605555554400000333
+values : 333 44 555555 06 07
+align/size : 1 13
+
+---- TEST 2 - MS-BITFIELDS - PACKED ----
+bits in use : 00000000000000030F7FFFFFFFFFFFFFFF3F00000FFF
+bits as set : 000000000000000205123456789ABCDEF01E00000003
+values : 03 1e 123456789abcdef0 05 fffffffffffffffe
+align/size : 1 22
+
+---- TEST 3 - MS-BITFIELDS - PACKED ----
+bits in use : 001F1F0000001F000003FF
+bits as set : 000E0600000019000002F5
+values : 15 17 19 06 0e
+align/size : 1 11
+
+---- TEST 4 - MS-BITFIELDS - PACKED ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 1 8
+
+---- TEST 5 - MS-BITFIELDS - PACKED ----
+bits in use : FFFFFF0000003FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 007744000000000000007800000000300000000000000123456789
+values : 0000000123456789 fffffffff0000000 0000000000000078 44 77
+align/size : 1 27
+
+---- TEST 6 - MS-BITFIELDS - PACKED ----
+bits in use : 00000000700000FFFFFFFFFFFFFF
+bits as set : 000000003000002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 1 14
+
+
+
+---- TEST 1 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 0000001FFFFFFFFF0000007F00000FFF
+bits as set : 00000007605555550000004400000333
+values : 333 44 555555 06 07
+align/size : 16 16
+
+---- TEST 2 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 0000000000000003000000000000000F7FFFFFFFFFFFFFFF0000003F00000FFF
+bits as set : 00000000000000020000000000000005123456789ABCDEF00000001E00000003
+values : 03 1e 123456789abcdef0 05 fffffffffffffffe
+align/size : 16 32
+
+---- TEST 3 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 0000000000000000000000000000001F000000000000001F0000001F000003FF
+bits as set : 0000000000000000000000000000000E000000000000000600000019000002F5
+values : 15 17 19 06 0e
+align/size : 16 32
+
+---- TEST 4 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 4 8
+
+---- TEST 5 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 00000000FFFF00FF0000003FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 0000000000770044000000000000007800000000300000000000000123456789
+values : 0000000123456789 fffffffff0000000 0000000000000078 44 77
+align/size : 8 32
+
+---- TEST 6 - MS-BITFIELDS - WITH ALIGN ----
+bits in use : 00000000000000700000FFFF000000FFFFFFFFFF
+bits as set : 000000000000003000002001000000FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 4 20
+
+
+
+---- TEST 1 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : 0000000000001FFFFFFFFF7F00000FFF
+bits as set : 00000000000007605555554400000333
+values : 333 44 555555 06 07
+align/size : 16 16
+
+---- TEST 2 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : 00000000000000030F0000007FFFFFFFFFFFFFFF3F00000FFF
+bits as set : 000000000000000205000000123456789ABCDEF01E00000003
+values : 03 1e 123456789abcdef0 05 fffffffffffffffe
+align/size : 16 25
+
+---- TEST 3 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : 001F000000000000001F0000001F000003FF
+bits as set : 000E000000000000000600000019000002F5
+values : 15 17 19 06 0e
+align/size : 16 18
+
+---- TEST 4 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : 0007FFFF00000027
+bits as set : 00078F0F00000023
+values : 03 ffffffff 0f fffffff8 78
+align/size : 1 8
+
+---- TEST 5 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : FFFFFF0000003FFFFFFFFF000000003FFFFFFF00001FFFFFFFFFFF
+bits as set : 007744000000000000007800000000300000000000000123456789
+values : 0000000123456789 fffffffff0000000 0000000000000078 44 77
+align/size : 1 27
+
+---- TEST 6 - MS-BITFIELDS - PACKED - WITH ALIGN ----
+bits in use : 00000000700000FFFFFFFFFFFFFF
+bits as set : 000000003000002001FD00000004
+values : 01 02 03 04 fffffffd
+align/size : 1 14
diff --git a/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.c b/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.c
new file mode 100644
index 0000000..cc211d3
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.c
@@ -0,0 +1,84 @@
+/*****************************************************************************/
+/* test 'nodata_wanted' data output suppression */
+
+#if defined test_static_data_error
+void foo() {
+ if (1) {
+ static short w = (int)&foo; /* initializer not computable */
+ }
+}
+
+#elif defined test_static_nodata_error
+void foo() {
+ if (0) {
+ static short w = (int)&foo; /* initializer not computable */
+ }
+}
+
+#elif defined test_global_data_error
+void foo();
+static short w = (int)&foo; /* initializer not computable */
+
+
+#elif defined test_local_data_noerror
+void foo() {
+ short w = &foo; /* 2 cast warnings */
+}
+
+#elif defined test_data_suppression_off || defined test_data_suppression_on
+
+#if defined test_data_suppression_on
+# define SKIP 1
+#else
+# define SKIP 0
+#endif
+
+#include <stdio.h>
+/* some gcc headers #define __attribute__ to empty if it's not gcc */
+#undef __attribute__
+
+int main()
+{
+ __label__ ts0, te0, ts1, te1;
+ int tl, dl;
+
+ static char ds0 = 0;
+ static char de0 = 0;
+ /* get reference size of empty jmp */
+ts0:;
+ if (!SKIP) {}
+te0:;
+ dl = -(&de0 - &ds0);
+ tl = -(&&te0 - &&ts0);
+
+ /* test data and code suppression */
+ static char ds1 = 0;
+ts1:;
+ if (!SKIP) {
+ static void *p = (void*)&main;
+ static char cc[] = "static string";
+ static double d = 8.0;
+
+ static struct __attribute__((packed)) {
+ unsigned x : 12;
+ unsigned char y : 7;
+ unsigned z : 28, a: 4, b: 5;
+ } s = { 0x333,0x44,0x555555,6,7 };
+
+ printf("data:\n");
+ printf(" %d - %.1f - %.1f - %s - %s\n",
+ sizeof 8.0, 8.0, d, __FUNCTION__, cc);
+ printf(" %x %x %x %x %x\n",
+ s.x, s.y, s.z, s.a, s.b);
+ }
+te1:;
+ static char de1 = 0;
+
+ dl += &de1 - &ds1;
+ tl += &&te1 - &&ts1;
+ printf("size of data/text:\n %s/%s\n",
+ dl ? "non-zero":"zero", tl ? "non-zero":"zero");
+ /*printf("# %d/%d\n", dl, tl);*/
+}
+
+#endif
diff --git a/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.expect b/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.expect
new file mode 100644
index 0000000..2749109
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/96_nodata_wanted.expect
@@ -0,0 +1,23 @@
+[test_static_data_error]
+96_nodata_wanted.c:7: error: initializer element is not computable at load time
+
+[test_static_nodata_error]
+96_nodata_wanted.c:14: error: initializer element is not computable at load time
+
+[test_global_data_error]
+96_nodata_wanted.c:20: error: initializer element is not computable at load time
+
+[test_local_data_noerror]
+96_nodata_wanted.c:25: warning: assignment makes integer from pointer without a cast
+96_nodata_wanted.c:25: warning: nonportable conversion from pointer to char/short
+
+[test_data_suppression_off]
+data:
+ 8 - 8.0 - 8.0 - main - static string
+ 333 44 555555 6 7
+size of data/text:
+ non-zero/non-zero
+
+[test_data_suppression_on]
+size of data/text:
+ zero/zero
diff --git a/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.c b/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.c
new file mode 100644
index 0000000..96fbab0
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.c
@@ -0,0 +1,12 @@
+// this file contains BMP chars encoded in UTF-8
+#include <stdio.h>
+#include <wchar.h>
+
+int main()
+{
+ wchar_t s[] = L"hello$$你好¢¢世界€€world";
+ wchar_t *p;
+ for (p = s; *p; p++) printf("%04X ", (unsigned) *p);
+ printf("\n");
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.expect b/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.expect
new file mode 100644
index 0000000..9a1593c
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/97_utf8_string_literal.expect
@@ -0,0 +1 @@
+0068 0065 006C 006C 006F 0024 0024 4F60 597D 00A2 00A2 4E16 754C 20AC 20AC 0077 006F 0072 006C 0064
diff --git a/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.c b/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.c
new file mode 100644
index 0000000..9b4e02f
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <stdlib.h>
+asm (
+ ".text;"
+ ".globl _us;.globl _ss;.globl _uc;.globl _sc;"
+ "_us:;_ss:;_uc:;_sc:;"
+ "movl $0x1234ABCD, %eax;"
+ "ret;"
+);
+
+#if 1
+#define us _us
+#define ss _ss
+#define uc _uc
+#define sc _sc
+#endif
+
+int main()
+{
+ unsigned short us(void);
+ short ss(void);
+ unsigned char uc(void);
+ signed char sc(void);
+
+ unsigned short (*fpus)(void) = us;
+ short (*fpss)(void) = ss;
+ unsigned char (*fpuc)(void) = uc;
+ signed char (*fpsc)(void) = sc;
+
+ printf("%08X %08X\n", us() + 1, fpus() + 1);
+ printf("%08X %08X\n", ss() + 1, fpss() + 1);
+ printf("%08X %08X\n", uc() + 1, fpuc() + 1);
+ printf("%08X %08X\n", sc() + 1, fpsc() + 1);
+ printf("\n");
+ printf("%08X %08X\n", fpus() + 1, us() + 1);
+ printf("%08X %08X\n", fpss() + 1, ss() + 1);
+ printf("%08X %08X\n", fpuc() + 1, uc() + 1);
+ printf("%08X %08X\n", fpsc() + 1, sc() + 1);
+
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.expect b/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.expect
new file mode 100644
index 0000000..c5752e8
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/98_al_ax_extend.expect
@@ -0,0 +1,9 @@
+0000ABCE 0000ABCE
+FFFFABCE FFFFABCE
+000000CE 000000CE
+FFFFFFCE FFFFFFCE
+
+0000ABCE 0000ABCE
+FFFFABCE FFFFABCE
+000000CE 000000CE
+FFFFFFCE FFFFFFCE
diff --git a/05/tcc-0.9.27/tests/tests2/99_fastcall.c b/05/tcc-0.9.27/tests/tests2/99_fastcall.c
new file mode 100644
index 0000000..ee4b67d
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/99_fastcall.c
@@ -0,0 +1,276 @@
+#include <stdio.h>
+#include <assert.h>
+
+#ifndef _WIN32
+#define __fastcall __attribute((fastcall))
+#endif
+
+#if 1
+#define SYMBOL(x) _##x
+#else
+#define SYMBOL(x) x
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+////////// TRAP FRAMEWORK
+/////////////////////////////////////////////////////////////////////////
+// if you cast 'TRAP' to a function pointer and call it,
+// it will save all 8 registers,
+// and jump into C-code (previously set using 'SET_TRAP_HANDLER(x)'),
+// in C-code you can pop DWORDs from stack and modify registers
+//
+
+void *SYMBOL(trap_handler);
+
+extern unsigned char SYMBOL(trap)[];
+asm (
+ ".text;"
+ "_trap:;"
+ "pushl %esp;"
+ "pusha;"
+ "addl $0x4, 0xc(%esp);"
+ "pushl %esp;"
+ "call *_trap_handler;"
+ "addl $0x4, %esp;"
+ "movl 0xc(%esp), %eax;"
+ "movl %eax, 0x20(%esp);"
+ "popa;"
+ "popl %esp;"
+ "ret;"
+);
+
+struct trapframe {
+ unsigned edi, esi, ebp, esp, ebx, edx, ecx, eax;
+};
+
+
+#define M_FLOAT(addr) (*(float *)(addr))
+#define M_DWORD(addr) (*(unsigned *)(addr))
+#define M_WORD(addr) (*(unsigned short *)(addr))
+#define M_BYTE(addr) (*(unsigned char *)(addr))
+#define R_EAX ((tf)->eax)
+#define R_ECX ((tf)->ecx)
+#define R_EDX ((tf)->edx)
+#define R_EBX ((tf)->ebx)
+#define R_ESP ((tf)->esp)
+#define R_EBP ((tf)->ebp)
+#define R_ESI ((tf)->esi)
+#define R_EDI ((tf)->edi)
+
+#define ARG(x) (M_DWORD(R_ESP + (x) * 4))
+
+#define RETN(x) do { \
+ M_DWORD(R_ESP + (x)) = M_DWORD(R_ESP); \
+ R_ESP += (x); \
+} while (0)
+
+#define DUMP() do { \
+ unsigned i; \
+ printf("EAX: %08X\n", R_EAX); \
+ printf("ECX: %08X\n", R_ECX); \
+ printf("EDX: %08X\n", R_EDX); \
+ printf("EBX: %08X\n", R_EBX); \
+ printf("ESP: %08X\n", R_ESP); \
+ printf("EBP: %08X\n", R_EBP); \
+ printf("ESI: %08X\n", R_ESI); \
+ printf("EDI: %08X\n", R_EDI); \
+ printf("\n"); \
+ printf("[RETADDR]: %08X\n", M_DWORD(R_ESP)); \
+ for (i = 1; i <= 8; i++) { \
+ printf("[ARG%4d]: %08X\n", i, ARG(i)); \
+ } \
+} while (0)
+
+#define SET_TRAP_HANDLER(x) ((SYMBOL(trap_handler)) = (x))
+#define TRAP ((void *) &SYMBOL(trap))
+
+
+
+/////////////////////////////////////////////////////////////////////////
+////////// SAFECALL FRAMEWORK
+/////////////////////////////////////////////////////////////////////////
+// this framework will convert any calling convention to cdecl
+// usage: first set call target with 'SET_SAFECALL_TARGET(x)'
+// then cast 'SAFECALL' to target function pointer type and invoke it
+// after calling, 'ESPDIFF' is the difference of old and new esp
+
+void *SYMBOL(sc_call_target);
+unsigned SYMBOL(sc_retn_addr);
+unsigned SYMBOL(sc_old_esp);
+unsigned SYMBOL(sc_new_esp);
+
+extern unsigned char SYMBOL(safecall)[];
+asm (
+ ".text;"
+ "_safecall:;"
+ "popl _sc_retn_addr;"
+ "movl %esp, _sc_old_esp;"
+ "call *_sc_call_target;"
+ "movl %esp, _sc_new_esp;"
+ "movl _sc_old_esp, %esp;"
+ "jmp *_sc_retn_addr;"
+);
+
+#define SET_SAFECALL_TARGET(x) ((SYMBOL(sc_call_target)) = (x))
+#define SAFECALL ((void *) &SYMBOL(safecall))
+#define ESPDIFF (SYMBOL(sc_new_esp) - SYMBOL(sc_old_esp))
+
+
+/////////////////////////////////////////////////////////////////////////
+////////// TEST FASTCALL INVOKE
+/////////////////////////////////////////////////////////////////////////
+
+void check_fastcall_invoke_0(struct trapframe *tf)
+{
+ //DUMP();
+ RETN(0);
+}
+
+void check_fastcall_invoke_1(struct trapframe *tf)
+{
+ //DUMP();
+ assert(R_ECX == 0x11111111);
+ RETN(0);
+}
+void check_fastcall_invoke_2(struct trapframe *tf)
+{
+ //DUMP();
+ assert(R_ECX == 0x11111111);
+ assert(R_EDX == 0x22222222);
+ RETN(0);
+}
+void check_fastcall_invoke_3(struct trapframe *tf)
+{
+ //DUMP();
+ assert(R_ECX == 0x11111111);
+ assert(R_EDX == 0x22222222);
+ assert(ARG(1) == 0x33333333);
+ RETN(1*4);
+}
+void check_fastcall_invoke_4(struct trapframe *tf)
+{
+ //DUMP();
+ assert(R_ECX == 0x11111111);
+ assert(R_EDX == 0x22222222);
+ assert(ARG(1) == 0x33333333);
+ assert(ARG(2) == 0x44444444);
+ RETN(2*4);
+}
+
+void check_fastcall_invoke_5(struct trapframe *tf)
+{
+ //DUMP();
+ assert(R_ECX == 0x11111111);
+ assert(R_EDX == 0x22222222);
+ assert(ARG(1) == 0x33333333);
+ assert(ARG(2) == 0x44444444);
+ assert(ARG(3) == 0x55555555);
+ RETN(3*4);
+}
+
+void test_fastcall_invoke()
+{
+ SET_TRAP_HANDLER(check_fastcall_invoke_0);
+ ((void __fastcall (*)(void)) TRAP)();
+
+ SET_TRAP_HANDLER(check_fastcall_invoke_1);
+ ((void __fastcall (*)(unsigned)) TRAP)(0x11111111);
+
+ SET_TRAP_HANDLER(check_fastcall_invoke_2);
+ ((void __fastcall (*)(unsigned, unsigned)) TRAP)(0x11111111, 0x22222222);
+
+ SET_TRAP_HANDLER(check_fastcall_invoke_3);
+ ((void __fastcall (*)(unsigned, unsigned, unsigned)) TRAP)(0x11111111, 0x22222222, 0x33333333);
+
+ SET_TRAP_HANDLER(check_fastcall_invoke_4);
+ ((void __fastcall (*)(unsigned, unsigned, unsigned, unsigned)) TRAP)(0x11111111, 0x22222222, 0x33333333, 0x44444444);
+
+ SET_TRAP_HANDLER(check_fastcall_invoke_5);
+ ((void __fastcall (*)(unsigned, unsigned, unsigned, unsigned, unsigned)) TRAP)(0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x55555555);
+}
+
+
+/////////////////////////////////////////////////////////////////////////
+////////// TEST FUNCTION CODE GENERATION
+/////////////////////////////////////////////////////////////////////////
+
+int __fastcall check_fastcall_espdiff_0(void)
+{
+ return 0;
+}
+
+int __fastcall check_fastcall_espdiff_1(int a)
+{
+ return a;
+}
+
+int __fastcall check_fastcall_espdiff_2(int a, int b)
+{
+ return a + b;
+}
+
+int __fastcall check_fastcall_espdiff_3(int a, int b, int c)
+{
+ return a + b + c;
+}
+
+int __fastcall check_fastcall_espdiff_4(int a, int b, int c, int d)
+{
+ return a + b + c + d;
+}
+
+int __fastcall check_fastcall_espdiff_5(int a, int b, int c, int d, int e)
+{
+ return a + b + c + d + e;
+}
+
+void test_fastcall_espdiff()
+{
+ int x;
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_0);
+ x = ((typeof(&check_fastcall_espdiff_0))SAFECALL)();
+ assert(x == 0);
+ assert(ESPDIFF == 0);
+
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_1);
+ x = ((typeof(&check_fastcall_espdiff_1))SAFECALL)(1);
+ assert(x == 1);
+ assert(ESPDIFF == 0);
+
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_2);
+ x = ((typeof(&check_fastcall_espdiff_2))SAFECALL)(1, 2);
+ assert(x == 1 + 2);
+ assert(ESPDIFF == 0);
+
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_3);
+ x = ((typeof(&check_fastcall_espdiff_3))SAFECALL)(1, 2, 3);
+ assert(x == 1 + 2 + 3);
+ assert(ESPDIFF == 1*4);
+
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_4);
+ x = ((typeof(&check_fastcall_espdiff_4))SAFECALL)(1, 2, 3, 4);
+ assert(x == 1 + 2 + 3 + 4);
+ assert(ESPDIFF == 2*4);
+
+ SET_SAFECALL_TARGET(check_fastcall_espdiff_5);
+ x = ((typeof(&check_fastcall_espdiff_5))SAFECALL)(1, 2, 3, 4, 5);
+ assert(x == 1 + 2 + 3 + 4 + 5);
+ assert(ESPDIFF == 3*4);
+}
+
+int main()
+{
+#define N 10000
+ int i;
+
+ for (i = 1; i <= N; i++) {
+ test_fastcall_espdiff();
+ }
+
+ for (i = 1; i <= N; i++) {
+ test_fastcall_invoke();
+ }
+
+ puts("TEST OK");
+ return 0;
+}
diff --git a/05/tcc-0.9.27/tests/tests2/99_fastcall.expect b/05/tcc-0.9.27/tests/tests2/99_fastcall.expect
new file mode 100644
index 0000000..3835d63
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/99_fastcall.expect
@@ -0,0 +1 @@
+TEST OK
diff --git a/05/tcc-0.9.27/tests/tests2/LICENSE b/05/tcc-0.9.27/tests/tests2/LICENSE
new file mode 100644
index 0000000..b08a652
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/LICENSE
@@ -0,0 +1,37 @@
+The tests in this directory are either directly copied from the picoc project or
+are subsequently modified and added to for the purpose of TinyCC project. All
+these modifications are licensed under the same terms as TinyCC as specified in
+the file COPYING.
+
+=== picoc license ===
+
+Copyright (c) 2009-2011, Zik Saleeba
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ * Neither the name of the Zik Saleeba nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/05/tcc-0.9.27/tests/tests2/Makefile b/05/tcc-0.9.27/tests/tests2/Makefile
new file mode 100644
index 0000000..190b2d9
--- /dev/null
+++ b/05/tcc-0.9.27/tests/tests2/Makefile
@@ -0,0 +1,112 @@
+TOP = ../..
+include $(TOP)/Makefile
+SRC = $(TOPSRC)/tests/tests2
+VPATH = $(SRC)
+
+TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c))))
+
+# some tests do not pass on all platforms, remove them for now
+SKIP = 34_array_assignment.test # array assignment is not in C standard
+ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
+ SKIP += 22_floating_point.test
+endif
+ifdef CONFIG_OSX
+ SKIP += 40_stdio.test 42_function_pointer.test
+ FLAGS += -w
+endif
+ifeq ($(ARCH),x86_64)
+ SKIP += 73_arm64.test
+endif
+ifeq (,$(filter i386,$(ARCH)))
+ SKIP += 98_al_ax_extend.test 99_fastcall.test
+endif
+ifeq (,$(filter i386 x86_64,$(ARCH)))
+ SKIP += 85_asm-outside-function.test
+endif
+ifeq (-$(findstring gcc,$(CC))-,--)
+ SKIP += $(patsubst %.expect,%.test,$(GEN-ALWAYS))
+endif
+ifeq (-$(CONFIG_WIN32)-$(CONFIG_i386)$(CONFIG_arm)-,--yes-)
+ SKIP += 95_bitfields%.test # type_align is different on 32bit-non-windows
+endif
+
+# Some tests might need arguments
+ARGS =
+31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
+46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
+
+# And some tests don't test the right thing with -run
+NORUN =
+42_function_pointer.test : NORUN = true
+
+# Some tests might need different flags
+FLAGS =
+76_dollars_in_identifiers.test : FLAGS += -fdollars-in-identifiers
+
+# These tests run several snippets from the same file one by one
+60_errors_and_warnings.test : FLAGS += -dt
+96_nodata_wanted.test : FLAGS += -dt
+
+# Always generate certain .expects (don't put these in the GIT),
+GEN-ALWAYS =
+# GEN-ALWAYS += 95_bitfields.expect # does not work
+
+# using the ms compiler for the really ms-compatible bitfields
+95_bitfields_ms.test : GEN = $(GEN-MSC)
+
+# Filter source directory in warnings/errors (out-of-tree builds)
+FILTER = 2>&1 | sed 's,$(SRC)/,,g'
+# Filter some always-warning
+ifeq (-$(findstring arm,$(ARCH))-,-arm-)
+FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported'
+endif
+
+all test tests2.all: $(filter-out $(SKIP),$(TESTS)) ;
+
+%.test: %.c %.expect
+ @echo Test: $*...
+ @$(if $(NORUN),$(T1),$(T2)) $(if $(NODIFF),,$(T3))
+
+T1 = $(TCC) $(FLAGS) $< -o a.exe && ./a.exe $(ARGS)
+T2 = $(TCC) $(FLAGS) -run $< $(ARGS)
+T3 = $(FILTER) >$*.output 2>&1 || true \
+ && diff -Nbu $(filter %.expect,$^) $*.output \
+ && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS))
+
+# run single test and update .expect file, e.g. "make tests2.37+"
+tests2.%+:
+ @$(MAKE) $(call F2,$(call F1,$*)) --no-print-directory
+
+# just run tcc to see the output, e.g. "make tests2.37-"
+tests2.%-:
+ @$(MAKE) $(call F1,$*) NODIFF=true --no-print-directory
+
+# run single test, e.g. "make tests2.37"
+tests2.%:
+ @$(MAKE) $(call F1,$*) --no-print-directory
+
+F1 = $(or $(filter $1_%,$(TESTS)),$1_???.test)
+F2 = $1 UPDATE="$(patsubst %.test,%.expect,$1)"
+
+# automatically generate .expect files with gcc:
+%.expect :
+ @echo Generating: $@
+ @$(call GEN,$(SRC)/$*.c) $(FILTER) >$@ 2>&1
+ @rm -f *.exe *.obj *.pdb
+
+# using TCC for .expect if -dt in FLAGS
+GEN = $(if $(filter -dt,$(FLAGS)),$(GEN-TCC),$(GEN-CC))
+GEN-CC = $(CC) -w -std=gnu99 $(FLAGS) $1 -o a.exe && ./a.exe $(ARGS)
+GEN-TCC = $(TCC) $(FLAGS) -run $1 $(ARGS)
+GEN-MSC = $(MS-CC) $1 && ./$(basename $@).exe
+MS-CC = cl
+
+# tell make not to delete
+.PRECIOUS: %.expect
+
+# force .expect generation for these files
+$(sort $(GEN-ALWAYS) $(UPDATE)) : force
+force:
+
+clean:
+ rm -f fred.txt *.output a.exe $(GEN-ALWAYS)