From 3ed1d9a18b5b1c6092d829e6757344abc6deb024 Mon Sep 17 00:00:00 2001 From: kreofil Date: Tue, 16 Aug 2022 12:00:31 +0300 Subject: [PATCH] The refactoring of the good and bad tests --- .../bad/algorthms/hanoy/00181/00181.c | 130 +++++ .../ptr_bin_op/ptr_plus_val/ptr_plus_long.c | 16 + .../bad/operations/question/00076/00076.c | 17 + .../bad/operations/question/00109/00109.c | 19 + .../bad/operations/question/00137/00137.c | 18 + .../bad/operations/question/00138/00138.c | 18 + .../bad/operations/question/00144/00144.c | 25 + .../bad/operations/question/00183/00183.c | 23 + .../bad/operations/shift/00200/00200.c | 52 ++ .../bad/operations/sizeof/00038/00038.c | 25 + .../bad/operations/sizeof/00057/00057.c | 17 + .../bad/operations/sizeof/00077/00077.c | 56 ++ .../bad/operations/sizeof/00093/00093.c | 18 + .../bad/operations/sizeof/00155/00155.c | 15 + .../bad/operations/sizeof/00212/00212.c | 38 ++ .../for_main/bad/operators/00174/00174.c | 59 ++ .../bad/operators/loops/00041/00041.c | 34 ++ .../bad/operators/loops/00041/readme.txt | 1 + .../operators/switch/switch01/00051/00051.c | 46 ++ .../operators/switch/switch01/00143/00143.c | 45 ++ .../{ => types}/base_types/type_bool/bool01.c | 0 .../{ => types}/base_types/type_bool/bool02.c | 0 .../base_types/type_bool/type_bool01.c | 0 .../base_types/type_bool/type_bool02.c | 0 .../base_types/type_bool/type_bool0_full.c | 0 .../types/base_types/type_char/00025/00025.c | 29 + .../types/base_types/type_char/00058/00058.c | 23 + .../types/base_types/type_char/00078/00078.c | 25 + .../types/base_types/type_char/00132/00132.c | 26 + .../types/base_types/type_char/00173/00173.c | 41 ++ .../base_types/type_char/00177c/00177.c | 0 .../types/base_types/type_char/00208/00208.c | 25 + .../types/base_types/type_char/00216/00216.c | 284 ++++++++++ .../base_types/type_char/type_char01.c | 0 .../base_types/type_char/type_char02.c | 0 .../base_types/type_char/type_char04.c | 0 .../base_types/type_char/type_char06.c | 0 .../base_types/type_char/type_char07.c | 0 .../base_types/type_char/type_char08.c | 0 .../type_uns_long(long)/00082/00082.c | 19 + .../type_uns_long(long)/00134/00134.c | 33 ++ .../type_uns_long(long)/00135/00135.c | 31 + .../type_uns_long(long)/00204/00204.c | 532 ++++++++++++++++++ .../type_uns_long(long)/00215/00215.c | 107 ++++ .../type_uns_long(long)/00217/00217.c | 16 + .../types/composite_types/array/00092/00092.c | 27 + .../types/composite_types/array/00148/00148.c | 24 + .../types/composite_types/array/00151/00151.c | 24 + .../types/composite_types/array/00154/00154.c | 39 ++ .../types/composite_types/array/00205/00205.c | 33 ++ .../composite_types}/array/arr3d/arr3d1.c | 0 .../composite_types}/array/arr3d/arr3d3.c | 0 .../composite_types}/array/array07.c | 0 .../composite_types}/array/array08.c | 0 .../composite_types}/array/array2scalar.c | 0 .../composite_types/funptr/00087/00087.c | 28 + .../composite_types/funptr/00088/00088.c | 19 + .../composite_types/funptr/00089/00089.c | 38 ++ .../composite_types/funptr/00095/00095.c | 30 + .../composite_types/funptr/00124/00124.c | 30 + .../composite_types/funptr/00159/00159.c | 43 ++ .../composite_types/funptr/00170/00170.c | 80 +++ .../composite_types}/funptr/00189/00189.c | 0 .../composite_types/funptr/00209/00209.c | 48 ++ .../composite_types}/funptr/00210/00210.c | 0 .../composite_types/funptr/00219/00219.c | 72 +++ .../composite_types/pointers/00013/00013.c | 18 + .../composite_types/pointers/00014/00014.c | 19 + .../composite_types/pointers/00026/00026.c | 17 + .../composite_types/pointers/00032/00032.c | 38 ++ .../composite_types/pointers/00037/00037.c | 25 + .../composite_types/pointers/00072/00072.c | 22 + .../composite_types/pointers/00073/00073.c | 22 + .../composite_types/pointers/00130/00130.c | 30 + .../composite_types/pointers/00149/00149.c | 20 + .../composite_types/pointers/00163/00163.c | 48 ++ .../local_ptr/char/char_ptr01/char_ptr01.c | 0 .../local_ptr/char/char_ptr02/char_ptr02.c | 0 .../local_ptr/char/char_ptr03/char_ptr03.c | 0 .../ulonglong_ptr01/ulonglong_ptr01.c | 0 .../ulonglong_ptr03/ulonglong_ptr02.c | 0 .../ulonnglong_ptr02/ulonglong_ptr03.c | 0 .../pointers/other/pointers01.c | 0 .../pointers/other/pointers03.c | 0 .../pointers/other/pointers07.c | 0 .../char/char_ptr01/char_ptr01.c | 0 .../char/char_ptr02/char_ptr02.c | 0 .../char/char_ptr03/char_ptr03.c | 0 .../double/double_ptr02/double_ptr02.c | 0 .../int/int_ptr02/int_ptr02.c | 0 .../long_long_ptr02/long_long_ptr02.c | 0 .../short/short_ptr02/short_ptr02.c | 0 .../unsigned_int/uint_ptr01/uint_ptr01.c | 0 .../unsigned_int/uint_ptr02/uint_ptr02.c | 0 .../unsigned_int/uint_ptr03/uint_ptr03.c | 0 .../ulonglong_ptr01/ulonglong_ptr01.c | 0 .../ulonglong_ptr03/ulonglong_ptr02.c | 0 .../ulonnglong_ptr02/ulonglong_ptr03.c | 0 .../ushort_ptr01/ushort_ptr01.c | 0 .../ushort_ptr02/ushort_ptr02.c | 0 .../ushort_ptr03/ushort_ptr03.c | 0 .../composite_types/struct/00050/00050.c | 41 ++ .../composite_types/struct/00053/00053.c | 21 + .../composite_types/struct/00091/00091.c | 27 + .../composite_types/struct/00150/00150.c | 41 ++ .../composite_types/struct/trian/trian01.c | 10 + .../bad/types/type_casting/00104/00104.c | 37 ++ .../bad/types/type_casting/00113/00113.c | 16 + .../bad/types/type_casting/00128/00128.c | 150 +++++ .../type_casting/type_int32_to_int64d.c | 0 .../type_casting/type_int32_to_int64x.c | 0 .../type_casting/type_int64_to_int32d.c | 0 .../for_main/bad/variables/00096/00096.c | 20 + .../for_main/bad/variables/00175/00175.c | 62 ++ .../init/double/init_double.c | 0 .../bad/variables/init/pointer/00045/00045.c | 24 + .../{var => variables}/static/00197/00197.c | 0 .../some_local_static/some_local_static01.c | 0 .../some_local_static/some_local_static02.c | 0 .../some_local_static/some_local_static03.c | 0 .../for_main/good/functions/extproto03.c | 36 ++ .../for_main/good/operators/switch/switch03.c | 67 +++ .../good/test_suit_good/00027/00027.c | 18 + .../good/test_suit_good/00031/00031.c | 56 ++ .../good/test_suit_good/00033/00033.c | 53 ++ .../good/test_suit_good/00042/00042.c | 19 + .../good/test_suit_good/00046/00046.c | 41 ++ .../good/test_suit_good/00047/00047.c | 22 + .../good/test_suit_good/00048/00048.c | 20 + .../good/test_suit_good/00049/00049.c | 22 + .../good/test_suit_good/00054/00054.c | 30 + .../good/test_suit_good/00055/00055.c | 30 + .../good/test_suit_good/00059/00059.c | 16 + .../good/test_suit_good/00090/00090.c | 22 + .../good/test_suit_good/00098/00098.c | 13 + .../good/test_suit_good/00101/00101.c | 18 + .../good/test_suit_good/00112/00112.c | 13 + .../good/test_suit_good/00115/00115.c | 25 + .../good/test_suit_good/00117/00117.c | 13 + .../good/test_suit_good/00118/00118.c | 14 + .../good/test_suit_good/00120/00120.c | 18 + .../good/test_suit_good/00125/00125.c | 16 + .../good/test_suit_good/00131/00131.c | 22 + .../good/test_suit_good/00133/00133.c | 32 ++ .../good/test_suit_good/00146/00146.c | 20 + .../good/test_suit_good/00147/00147.c | 21 + .../good/test_suit_good/00157/00157.c | 29 + .../good/test_suit_good/00158/00158.c | 37 ++ .../good/test_suit_good/00160/00160.c | 32 ++ .../good/test_suit_good/00161/00161.c | 32 ++ .../good/test_suit_good/00162/00162.c | 42 ++ .../good/test_suit_good/00164/00164.c | 48 ++ .../good/test_suit_good/00165/00165.c | 22 + .../good/test_suit_good/00166/00166.c | 26 + .../good/test_suit_good/00167/00167.c | 29 + .../good/test_suit_good/00168/00168.c | 29 + .../good/test_suit_good/00169/00169.c | 29 + .../good/test_suit_good/00171/00171.c | 38 ++ .../good/test_suit_good/00172/00172.c | 32 ++ .../good/test_suit_good/00177c/00177.c | 25 + .../good/test_suit_good/00185i/00185.c | 36 ++ .../good/test_suit_good/00185l/00185.c | 36 ++ .../good/test_suit_good/00188/00188.c | 85 +++ .../good/test_suit_good/00218/00218.c | 57 ++ .../type_casting/typecast01_i64_to_f64_ass.c | 18 + .../type_casting/typecast01_i64_to_f64_expl.c | 17 + .../complex_types}/array/arr3d/arr3d2.c | 0 .../array/array_formula/array_formula.c | 0 .../array/exchange/exchange01.c | 0 .../{ => types}/complex_types/enum/enum01.c | 0 .../{ => types}/complex_types/enum/enum02.c | 0 .../pointers/full/pointers_full.c | 32 ++ .../unsigned_int/uint_ptr01/uint_ptr01.c | 0 .../unsigned_int/uint_ptr02/uint_ptr02.c | 0 .../unsigned_int/uint_ptr03/uint_ptr03.c | 0 .../complex_types/pointers/other/pointers02.c | 0 .../complex_types/pointers/other/pointers04.c | 0 .../complex_types/pointers/other/pointers05.c | 0 .../complex_types/pointers/other/pointers06.c | 0 .../pointers/ptr_arrow/ptr_arrow01.c | 27 + .../struct_ptr/struct_ptr01/struct_ptr01.c | 0 .../struct_ptr/struct_ptr02/struct_ptr02.c | 0 .../struct_ptr/struct_ptr03/struct_ptr03.c | 0 .../struct_ptr/struct_ptr04/struct_ptr04.c | 0 .../ushort_ptr01/ushort_ptr01.c | 0 .../ushort_ptr02/ushort_ptr02.c | 0 .../ushort_ptr03/ushort_ptr03.c | 0 .../pointers/while_ptr/while_ptr01.c | 0 .../figures/rect/rect_expl2_area_fun_i64f64.c | 27 + .../figures/union/uni_impl_area_fun_i64f64.c | 0 .../uni_impl_per_fun_i32f64_ast_nonamed.c | 58 ++ .../figures/union/uni_impl_per_fun_i64f64.c | 0 .../union/uni_impl_per_fun_i64f64_ast.c | 0 .../uni_impl_per_fun_i64f64_ast_nonamed.c | 0 .../complex_types/struct/struct00.c | 0 .../complex_types/struct/struct01.c | 0 .../complex_types/struct/struct02.c | 0 .../complex_types/struct/struct03.c | 0 .../complex_types/struct/struct04.c | 0 .../for_main/good/variables/dublicate.c | 29 + .../extvar/executable/extvar01.c | 0 .../extvar/executable/extvar02.c | 0 .../extvar/executable/extvar03.c | 0 .../extvar/executable/extvar04.c | 0 204 files changed, 4655 insertions(+) create mode 100644 project/tests/in_progress/for_main/bad/algorthms/hanoy/00181/00181.c create mode 100644 project/tests/in_progress/for_main/bad/operations/ptr_bin_op/ptr_plus_val/ptr_plus_long.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00076/00076.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00109/00109.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00137/00137.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00138/00138.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00144/00144.c create mode 100644 project/tests/in_progress/for_main/bad/operations/question/00183/00183.c create mode 100644 project/tests/in_progress/for_main/bad/operations/shift/00200/00200.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00038/00038.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00057/00057.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00077/00077.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00093/00093.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00155/00155.c create mode 100644 project/tests/in_progress/for_main/bad/operations/sizeof/00212/00212.c create mode 100644 project/tests/in_progress/for_main/bad/operators/00174/00174.c create mode 100644 project/tests/in_progress/for_main/bad/operators/loops/00041/00041.c create mode 100644 project/tests/in_progress/for_main/bad/operators/loops/00041/readme.txt create mode 100644 project/tests/in_progress/for_main/bad/operators/switch/switch01/00051/00051.c create mode 100644 project/tests/in_progress/for_main/bad/operators/switch/switch01/00143/00143.c rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_bool/bool01.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_bool/bool02.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_bool/type_bool01.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_bool/type_bool02.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_bool/type_bool0_full.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00025/00025.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00058/00058.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00078/00078.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00132/00132.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00173/00173.c rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/00177c/00177.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00208/00208.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_char/00216/00216.c rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char01.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char02.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char04.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char06.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char07.c (100%) rename project/tests/in_progress/for_main/bad/{ => types}/base_types/type_char/type_char08.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00082/00082.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00134/00134.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00135/00135.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00204/00204.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00215/00215.c create mode 100644 project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00217/00217.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/array/00092/00092.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/array/00148/00148.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/array/00151/00151.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/array/00154/00154.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/array/00205/00205.c rename project/tests/in_progress/for_main/bad/{ => types/composite_types}/array/arr3d/arr3d1.c (100%) rename project/tests/in_progress/for_main/bad/{ => types/composite_types}/array/arr3d/arr3d3.c (100%) rename project/tests/in_progress/for_main/bad/{ => types/composite_types}/array/array07.c (100%) rename project/tests/in_progress/for_main/bad/{ => types/composite_types}/array/array08.c (100%) rename project/tests/in_progress/for_main/bad/{ => types/composite_types}/array/array2scalar.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00087/00087.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00088/00088.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00089/00089.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00095/00095.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00124/00124.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00159/00159.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00170/00170.c rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/funptr/00189/00189.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00209/00209.c rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/funptr/00210/00210.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/funptr/00219/00219.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00013/00013.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00014/00014.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00026/00026.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00032/00032.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00037/00037.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00072/00072.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00073/00073.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00130/00130.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00149/00149.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/pointers/00163/00163.c rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/char/char_ptr01/char_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/char/char_ptr02/char_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/char/char_ptr03/char_ptr03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/local_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/other/pointers01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/other/pointers03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/other/pointers07.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/char/char_ptr01/char_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/char/char_ptr02/char_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/char/char_ptr03/char_ptr03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/double/double_ptr02/double_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/int/int_ptr02/int_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/long_long/long_long_ptr02/long_long_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/short/short_ptr02/short_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_int/uint_ptr01/uint_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_int/uint_ptr02/uint_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_int/uint_ptr03/uint_ptr03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_short/ushort_ptr01/ushort_ptr01.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_short/ushort_ptr02/ushort_ptr02.c (100%) rename project/tests/in_progress/for_main/bad/{complex_types => types/composite_types}/pointers/simple_types_ptr/unsigned_short/ushort_ptr03/ushort_ptr03.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/struct/00050/00050.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/struct/00053/00053.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/struct/00091/00091.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/struct/00150/00150.c create mode 100644 project/tests/in_progress/for_main/bad/types/composite_types/struct/trian/trian01.c create mode 100644 project/tests/in_progress/for_main/bad/types/type_casting/00104/00104.c create mode 100644 project/tests/in_progress/for_main/bad/types/type_casting/00113/00113.c create mode 100644 project/tests/in_progress/for_main/bad/types/type_casting/00128/00128.c rename project/tests/in_progress/for_main/bad/{base_types => types}/type_casting/type_int32_to_int64d.c (100%) rename project/tests/in_progress/for_main/bad/{base_types => types}/type_casting/type_int32_to_int64x.c (100%) rename project/tests/in_progress/for_main/bad/{base_types => types}/type_casting/type_int64_to_int32d.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/variables/00096/00096.c create mode 100644 project/tests/in_progress/for_main/bad/variables/00175/00175.c rename project/tests/in_progress/for_main/bad/{var => variables}/init/double/init_double.c (100%) create mode 100644 project/tests/in_progress/for_main/bad/variables/init/pointer/00045/00045.c rename project/tests/in_progress/for_main/bad/{var => variables}/static/00197/00197.c (100%) rename project/tests/in_progress/for_main/bad/{var => variables}/static/some_local_static/some_local_static01.c (100%) rename project/tests/in_progress/for_main/bad/{var => variables}/static/some_local_static/some_local_static02.c (100%) rename project/tests/in_progress/for_main/bad/{var => variables}/static/some_local_static/some_local_static03.c (100%) create mode 100644 project/tests/in_progress/for_main/good/functions/extproto03.c create mode 100644 project/tests/in_progress/for_main/good/operators/switch/switch03.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00027/00027.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00031/00031.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00033/00033.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00042/00042.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00046/00046.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00047/00047.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00048/00048.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00049/00049.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00054/00054.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00055/00055.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00059/00059.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00090/00090.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00098/00098.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00101/00101.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00112/00112.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00115/00115.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00117/00117.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00118/00118.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00120/00120.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00125/00125.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00131/00131.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00133/00133.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00146/00146.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00147/00147.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00157/00157.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00158/00158.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00160/00160.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00161/00161.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00162/00162.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00164/00164.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00165/00165.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00166/00166.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00167/00167.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00168/00168.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00169/00169.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00171/00171.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00172/00172.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00177c/00177.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00185i/00185.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00185l/00185.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00188/00188.c create mode 100644 project/tests/in_progress/for_main/good/test_suit_good/00218/00218.c create mode 100644 project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_ass.c create mode 100644 project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_expl.c rename project/tests/in_progress/for_main/good/{ => types/complex_types}/array/arr3d/arr3d2.c (100%) rename project/tests/in_progress/for_main/good/{ => types/complex_types}/array/array_formula/array_formula.c (100%) rename project/tests/in_progress/for_main/good/{ => types/complex_types}/array/exchange/exchange01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/enum/enum01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/enum/enum02.c (100%) create mode 100644 project/tests/in_progress/for_main/good/types/complex_types/pointers/full/pointers_full.c rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/local_ptr/unsigned_int/uint_ptr01/uint_ptr01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/local_ptr/unsigned_int/uint_ptr02/uint_ptr02.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/local_ptr/unsigned_int/uint_ptr03/uint_ptr03.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/other/pointers02.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/other/pointers04.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/other/pointers05.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/other/pointers06.c (100%) create mode 100644 project/tests/in_progress/for_main/good/types/complex_types/pointers/ptr_arrow/ptr_arrow01.c rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/struct_ptr/struct_ptr01/struct_ptr01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/struct_ptr/struct_ptr02/struct_ptr02.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/struct_ptr/struct_ptr03/struct_ptr03.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/struct_ptr/struct_ptr04/struct_ptr04.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/unsigned_short/ushort_ptr01/ushort_ptr01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/unsigned_short/ushort_ptr02/ushort_ptr02.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/unsigned_short/ushort_ptr03/ushort_ptr03.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/pointers/while_ptr/while_ptr01.c (100%) create mode 100644 project/tests/in_progress/for_main/good/types/complex_types/struct/figures/rect/rect_expl2_area_fun_i64f64.c rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/figures/union/uni_impl_area_fun_i64f64.c (100%) create mode 100644 project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i32f64_ast_nonamed.c rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/figures/union/uni_impl_per_fun_i64f64.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast_nonamed.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/struct00.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/struct01.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/struct02.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/struct03.c (100%) rename project/tests/in_progress/for_main/good/{ => types}/complex_types/struct/struct04.c (100%) create mode 100644 project/tests/in_progress/for_main/good/variables/dublicate.c rename project/tests/in_progress/for_main/good/{var => variables}/extvar/executable/extvar01.c (100%) rename project/tests/in_progress/for_main/good/{var => variables}/extvar/executable/extvar02.c (100%) rename project/tests/in_progress/for_main/good/{var => variables}/extvar/executable/extvar03.c (100%) rename project/tests/in_progress/for_main/good/{var => variables}/extvar/executable/extvar04.c (100%) diff --git a/project/tests/in_progress/for_main/bad/algorthms/hanoy/00181/00181.c b/project/tests/in_progress/for_main/bad/algorthms/hanoy/00181/00181.c new file mode 100644 index 00000000..b2b2409e --- /dev/null +++ b/project/tests/in_progress/for_main/bad/algorthms/hanoy/00181/00181.c @@ -0,0 +1,130 @@ +/* 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 +#include + +#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 +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/ptr_bin_op/ptr_plus_val/ptr_plus_long.c b/project/tests/in_progress/for_main/bad/operations/ptr_bin_op/ptr_plus_val/ptr_plus_long.c new file mode 100644 index 00000000..cc382a4b --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/ptr_bin_op/ptr_plus_val/ptr_plus_long.c @@ -0,0 +1,16 @@ +//clang -Xclang -ast-dump -fsyntax-only main.c +#include + +long array[3] = {0, 1, 2}; +long *ptr; + +int main() { + ptr = array; + printf("array[0] = %ld\n", *ptr); + ptr = array + 2; + printf("array[2] = %ld\n", *ptr); + --ptr; + printf("array[1] = %ld\n", *ptr); + + return 0; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00076/00076.c b/project/tests/in_progress/for_main/bad/operations/question/00076/00076.c new file mode 100644 index 00000000..336abb88 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00076/00076.c @@ -0,0 +1,17 @@ +int +test() +{ + if(0 ? 1 : 0) + return 1; + if(1 ? 0 : 1) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00109/00109.c b/project/tests/in_progress/for_main/bad/operations/question/00109/00109.c new file mode 100644 index 00000000..525df82e --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00109/00109.c @@ -0,0 +1,19 @@ +int +test() +{ + int x = 0; + int y = 1; + if(x ? 1 : 0) + return 1; + if(y ? 0 : 1) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00137/00137.c b/project/tests/in_progress/for_main/bad/operations/question/00137/00137.c new file mode 100644 index 00000000..599c8eb9 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00137/00137.c @@ -0,0 +1,18 @@ +#define x(y) #y + +int +test(void) +{ + char *p; + p = x(hello) " is better than bye"; + + return (*p == 'h') ? 0 : 1; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00138/00138.c b/project/tests/in_progress/for_main/bad/operations/question/00138/00138.c new file mode 100644 index 00000000..4102e645 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00138/00138.c @@ -0,0 +1,18 @@ +#define M(x) x +#define A(a,b) a(b) + +int +test(void) +{ + char *a = A(M,"hi"); + + return (a[1] == 'i') ? 0 : 1; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00144/00144.c b/project/tests/in_progress/for_main/bad/operations/question/00144/00144.c new file mode 100644 index 00000000..547188f1 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00144/00144.c @@ -0,0 +1,25 @@ +int +test(void) +{ + int i, *q; + void *p; + + i = i ? 0 : 0l; + p = i ? (void *) 0 : 0; + p = i ? 0 : (void *) 0; + p = i ? 0 : (const void *) 0; + q = i ? 0 : p; + q = i ? p : 0; + q = i ? q : 0; + q = i ? 0 : q; + + return (int) q; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/question/00183/00183.c b/project/tests/in_progress/for_main/bad/operations/question/00183/00183.c new file mode 100644 index 00000000..03d0b92e --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/question/00183/00183.c @@ -0,0 +1,23 @@ +#include + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/shift/00200/00200.c b/project/tests/in_progress/for_main/bad/operations/shift/00200/00200.c new file mode 100644 index 00000000..aa3e51a1 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/shift/00200/00200.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 . + +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 + +#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/project/tests/in_progress/for_main/bad/operations/sizeof/00038/00038.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00038/00038.c new file mode 100644 index 00000000..b37acfca --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00038/00038.c @@ -0,0 +1,25 @@ +int +test() +{ + int x, *p; + + if (sizeof(0) < 2) + return 1; + if (sizeof 0 < 2) + return 1; + if (sizeof(char) < 1) + return 1; + if (sizeof(int) - 2 < 0) + return 1; + if (sizeof(&x) != sizeof p) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/sizeof/00057/00057.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00057/00057.c new file mode 100644 index 00000000..98468131 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00057/00057.c @@ -0,0 +1,17 @@ +int +test() +{ + char a[16], b[16]; + + if(sizeof(a) != sizeof(b)) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/sizeof/00077/00077.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00077/00077.c new file mode 100644 index 00000000..e28483d5 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00077/00077.c @@ -0,0 +1,56 @@ +int +foo(int x[100]) +{ + int y[100]; + int *p; + + y[0] = 2000; + + if(x[0] != 1000) + { + return 1; + } + + p = x; + + if(p[0] != 1000) + { + return 2; + } + + p = y; + + if(p[0] != 2000) + { + return 3; + } + + if(sizeof(x) != sizeof(void*)) + { + return 4; + } + + if(sizeof(y) <= sizeof(x)) + { + return 5; + } + + return 0; +} + +int +test() +{ + int x[100]; + x[0] = 1000; + + return foo(x); +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/sizeof/00093/00093.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00093/00093.c new file mode 100644 index 00000000..3dc40875 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00093/00093.c @@ -0,0 +1,18 @@ +int a[] = {1, 2, 3, 4}; + +int +test() +{ + if (sizeof(a) != 4*sizeof(int)) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/sizeof/00155/00155.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00155/00155.c new file mode 100644 index 00000000..4dc44177 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00155/00155.c @@ -0,0 +1,15 @@ + +int +test(void) +{ + sizeof((int) 1); + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operations/sizeof/00212/00212.c b/project/tests/in_progress/for_main/bad/operations/sizeof/00212/00212.c new file mode 100644 index 00000000..744c3e20 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operations/sizeof/00212/00212.c @@ -0,0 +1,38 @@ +#include + +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/project/tests/in_progress/for_main/bad/operators/00174/00174.c b/project/tests/in_progress/for_main/bad/operators/00174/00174.c new file mode 100644 index 00000000..fdb384f2 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operators/00174/00174.c @@ -0,0 +1,59 @@ +#include +// Убрал внешнюю библиотеку +// #include + +int test() +{ + // 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operators/loops/00041/00041.c b/project/tests/in_progress/for_main/bad/operators/loops/00041/00041.c new file mode 100644 index 00000000..5522cb5a --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operators/loops/00041/00041.c @@ -0,0 +1,34 @@ +int +test() { + int n; + int t; + int c; + int p; + + c = 0; + n = 2; + while (n < 5000) { + t = 2; + p = 1; + while (t*t <= n) { + if (n % t == 0) + p = 0; + t++; + } + n++; + if (p) + c++; + } + if (c != 669) + return 1; + return 0; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operators/loops/00041/readme.txt b/project/tests/in_progress/for_main/bad/operators/loops/00041/readme.txt new file mode 100644 index 00000000..25f9c75f --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operators/loops/00041/readme.txt @@ -0,0 +1 @@ +Зацикливается... diff --git a/project/tests/in_progress/for_main/bad/operators/switch/switch01/00051/00051.c b/project/tests/in_progress/for_main/bad/operators/switch/switch01/00051/00051.c new file mode 100644 index 00000000..279e41af --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operators/switch/switch01/00051/00051.c @@ -0,0 +1,46 @@ +int x = 0; + +int +test() +{ + switch(x) + case 0: + ; + switch(x) + case 0: + switch(x) { + case 0: + goto next; + default: + return 1; + } + return 1; + next: + switch(x) + case 1: + return 1; + switch(x) { + { + x = 1 + 1; + foo: + case 1: + return 1; + } + } + switch(x) { + case 0: + return x; + case 1: + return 1; + default: + return 1; + } +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/operators/switch/switch01/00143/00143.c b/project/tests/in_progress/for_main/bad/operators/switch/switch01/00143/00143.c new file mode 100644 index 00000000..99cf6bf5 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/operators/switch/switch01/00143/00143.c @@ -0,0 +1,45 @@ +/* Disgusting, no? But it compiles and runs just fine. I feel a combination of + pride and revulsion at this discovery. If no one's thought of it before, + I think I'll name it after myself. + It amazes me that after 10 years of writing C there are still + little corners that I haven't explored fully. + - Tom Duff */ + +int test() +{ + int count, n; + short *from, *to; + short a[39], b[39]; + + for(n = 0; n < 39; n++) { + a[n] = n; + b[n] = 0; + } + from = a; + to = b; + count = 39; + n = (count + 7) / 8; + switch (count % 8) { + case 0: do { *to++ = *from++; + case 7: *to++ = *from++; + case 6: *to++ = *from++; + case 5: *to++ = *from++; + case 4: *to++ = *from++; + case 3: *to++ = *from++; + case 2: *to++ = *from++; + case 1: *to++ = *from++; + } while (--n > 0); + } + for(n = 0; n < 39; n++) + if(a[n] != b[n]) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/base_types/type_bool/bool01.c b/project/tests/in_progress/for_main/bad/types/base_types/type_bool/bool01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_bool/bool01.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_bool/bool01.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_bool/bool02.c b/project/tests/in_progress/for_main/bad/types/base_types/type_bool/bool02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_bool/bool02.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_bool/bool02.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool01.c b/project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool01.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool01.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool02.c b/project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool02.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool02.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool0_full.c b/project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool0_full.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_bool/type_bool0_full.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_bool/type_bool0_full.c diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00025/00025.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00025/00025.c new file mode 100644 index 00000000..724308d2 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00025/00025.c @@ -0,0 +1,29 @@ +// int strlen(char *); +// Замена функции на свою для прохождения теста +int strlen_for_test(char * s) { + char* t = s; + int c = 0; + while(*t != '\0') { + ++t; + ++c; + } + return c; +} + +int +test() +{ + char *p; + + p = "hello"; +// return strlen(p) - 5; + return strlen_for_test(p) - 5; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00058/00058.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00058/00058.c new file mode 100644 index 00000000..4932d344 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00058/00058.c @@ -0,0 +1,23 @@ +int test() +{ + char * s; + + s = "abc" "def"; + if(s[0] != 'a') return 1; + if(s[1] != 'b') return 2; + if(s[2] != 'c') return 3; + if(s[3] != 'd') return 4; + if(s[4] != 'e') return 5; + if(s[5] != 'f') return 6; + if(s[6] != 0) return 7; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00078/00078.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00078/00078.c new file mode 100644 index 00000000..d687702b --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00078/00078.c @@ -0,0 +1,25 @@ +int +f1(char *p) +{ + return *p+1; +} + +int +test() +{ + char s = 1; + int v[1000]; + int f1(char *); + + if (f1(&s) != 2) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00132/00132.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00132/00132.c new file mode 100644 index 00000000..fb20826b --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00132/00132.c @@ -0,0 +1,26 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00173/00173.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00173/00173.c new file mode 100644 index 00000000..fbf9cc5a --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00173/00173.c @@ -0,0 +1,41 @@ +#include + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/00177c/00177.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00177c/00177.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/00177c/00177.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/00177c/00177.c diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_char/00208/00208.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00208/00208.c new file mode 100644 index 00000000..62f743d8 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00208/00208.c @@ -0,0 +1,25 @@ +#include +struct wchar { + char *data; char mem[1]; +}; +struct wint { + char *data; int mem[1]; +}; +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/project/tests/in_progress/for_main/bad/types/base_types/type_char/00216/00216.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00216/00216.c new file mode 100644 index 00000000..c6f7758a --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_char/00216/00216.c @@ -0,0 +1,284 @@ +#include + +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 +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/project/tests/in_progress/for_main/bad/base_types/type_char/type_char01.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char01.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char01.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/type_char02.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char02.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char02.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/type_char04.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char04.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char04.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char04.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/type_char06.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char06.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char06.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char06.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/type_char07.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char07.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char07.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char07.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_char/type_char08.c b/project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char08.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_char/type_char08.c rename to project/tests/in_progress/for_main/bad/types/base_types/type_char/type_char08.c diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00082/00082.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00082/00082.c new file mode 100644 index 00000000..b866d131 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00082/00082.c @@ -0,0 +1,19 @@ +int +test() +{ + unsigned long long x; + + x = 0; + x = x + 1; + if (x != 1) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00134/00134.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00134/00134.c new file mode 100644 index 00000000..11714f13 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00134/00134.c @@ -0,0 +1,33 @@ +int +test(void) +{ + long i; + unsigned long u; + + i = 1; + i = -1; + i = -1l; + i = -1u; + i = -1ll; + i = (1ll << 32) - 1 & 3; + i = (long) ((1ll << 32) - 1) < 0; + i = -1u < 0; + + u = 1; + u = -1; + u = -1l; + u = -1u; + u = -1ll; + u = (1ll << 32) - 1 & 3; + u = (long) ((1ll << 32) - 1) < 0; + u = -1u < 0; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00135/00135.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00135/00135.c new file mode 100644 index 00000000..3b19f15c --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00135/00135.c @@ -0,0 +1,31 @@ +int +test(void) +{ + long long i; + unsigned long long u; + + i = 1; + i = -1; + i = -1l; + i = -1u; + i = -1ll; + i = -1ll & 3; + i = -1ll < 0; + + u = 1; + u = -1; + u = -1l; + u = -1u; + u = -1ll; + u = -1llu & 3; + u = -1llu < 0; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00204/00204.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00204/00204.c new file mode 100644 index 00000000..f8bcf730 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00204/00204.c @@ -0,0 +1,532 @@ +// 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 +// #include +#include + +typedef int int32_t; +typedef long int int64_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +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/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00215/00215.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00215/00215.c new file mode 100644 index 00000000..9445136c --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00215/00215.c @@ -0,0 +1,107 @@ +#include +// extern int printf(const char *format, ...); +static void kb_wait_1(void) +{ + unsigned long timeout = 2; + do { + if (1) printf("timeout=%ld\n", timeout); + else + { + while (1) + printf("error\n"); + } + timeout--; + } while (timeout); +} +static void kb_wait_2(void) +{ + unsigned long timeout = 2; + do { + if (1) printf("timeout=%ld\n", timeout); + else + { + for (;;) + printf("error\n"); + } + timeout--; + } while (timeout); +} +static void kb_wait_2_1(void) +{ + unsigned long timeout = 2; + do { + if (1) printf("timeout=%ld\n", timeout); + else + { + do { + printf("error\n"); + } while (1); + } + timeout--; + } while (timeout); +} +static void kb_wait_2_2(void) +{ + unsigned long timeout = 2; + do { + if (1) printf("timeout=%ld\n", timeout); + else + { + label: + printf("error\n"); + goto label; + } + timeout--; + } while (timeout); +} +static void kb_wait_3(void) +{ + unsigned long timeout = 2; + do { + if (1) printf("timeout=%ld\n", timeout); + else + { + 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 { + if (1) printf("timeout=%ld\n", timeout); + else + { + 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/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00217/00217.c b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00217/00217.c new file mode 100644 index 00000000..08695779 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/base_types/type_uns_long(long)/00217/00217.c @@ -0,0 +1,16 @@ +#include +// 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/project/tests/in_progress/for_main/bad/types/composite_types/array/00092/00092.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/00092/00092.c new file mode 100644 index 00000000..922ec854 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/array/00092/00092.c @@ -0,0 +1,27 @@ +int a[] = {5, [2] = 2, 3}; + +int +test() +{ + if (sizeof(a) != 4*sizeof(int)) + return 1; + + if (a[0] != 5) + return 2; + if (a[1] != 0) + return 3; + if (a[2] != 2) + return 4; + if (a[3] != 3) + return 5; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/array/00148/00148.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/00148/00148.c new file mode 100644 index 00000000..0e6f05a7 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/array/00148/00148.c @@ -0,0 +1,24 @@ +struct S {int a; int b;}; +struct S arr[2] = {[1] = {3, 4}, [0] = {1, 2}}; + +int +test() +{ + if(arr[0].a != 1) + return 1; + if(arr[0].b != 2) + return 2; + if(arr[1].a != 3) + return 3; + if(arr[1].b != 4) + return 4; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/array/00151/00151.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/00151/00151.c new file mode 100644 index 00000000..f7c76e71 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/array/00151/00151.c @@ -0,0 +1,24 @@ +int arr[][3][5] = { + { + { 0, 0, 3, 5 }, + { 1, [3] = 6, 7 }, + }, + { + { 1, 2 }, + { [4] = 7, }, + }, +}; + +int +test(void) +{ + return !(arr[0][1][4] == arr[1][1][4]); +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/array/00154/00154.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/00154/00154.c new file mode 100644 index 00000000..93eab092 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/array/00154/00154.c @@ -0,0 +1,39 @@ +#include + +struct fred +{ + int boris; + int natasha; +}; + +int test() +{ + 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; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/array/00205/00205.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/00205/00205.c new file mode 100644 index 00000000..234e3c4f --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/array/00205/00205.c @@ -0,0 +1,33 @@ +#include + +/* 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/project/tests/in_progress/for_main/bad/array/arr3d/arr3d1.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/arr3d/arr3d1.c similarity index 100% rename from project/tests/in_progress/for_main/bad/array/arr3d/arr3d1.c rename to project/tests/in_progress/for_main/bad/types/composite_types/array/arr3d/arr3d1.c diff --git a/project/tests/in_progress/for_main/bad/array/arr3d/arr3d3.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/arr3d/arr3d3.c similarity index 100% rename from project/tests/in_progress/for_main/bad/array/arr3d/arr3d3.c rename to project/tests/in_progress/for_main/bad/types/composite_types/array/arr3d/arr3d3.c diff --git a/project/tests/in_progress/for_main/bad/array/array07.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/array07.c similarity index 100% rename from project/tests/in_progress/for_main/bad/array/array07.c rename to project/tests/in_progress/for_main/bad/types/composite_types/array/array07.c diff --git a/project/tests/in_progress/for_main/bad/array/array08.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/array08.c similarity index 100% rename from project/tests/in_progress/for_main/bad/array/array08.c rename to project/tests/in_progress/for_main/bad/types/composite_types/array/array08.c diff --git a/project/tests/in_progress/for_main/bad/array/array2scalar.c b/project/tests/in_progress/for_main/bad/types/composite_types/array/array2scalar.c similarity index 100% rename from project/tests/in_progress/for_main/bad/array/array2scalar.c rename to project/tests/in_progress/for_main/bad/types/composite_types/array/array2scalar.c diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00087/00087.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00087/00087.c new file mode 100644 index 00000000..b39370a3 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00087/00087.c @@ -0,0 +1,28 @@ +struct S +{ + int (*fptr)(); +}; + +int +foo() +{ + return 0; +} + +int +test() +{ + struct S v; + + v.fptr = foo; + return v.fptr(); +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00088/00088.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00088/00088.c new file mode 100644 index 00000000..6d385dc4 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00088/00088.c @@ -0,0 +1,19 @@ +int (*fptr)() = 0; + + +int +test() +{ + if (fptr) + return 1; + return 0; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00089/00089.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00089/00089.c new file mode 100644 index 00000000..c1d70d01 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00089/00089.c @@ -0,0 +1,38 @@ +int +zero() +{ + return 0; +} + +struct S +{ + int (*zerofunc)(); +} s = { &zero }; + +struct S * +anon() +{ + return &s; +} + +typedef struct S * (*fty)(); + +fty +go() +{ + return &anon; +} + +int +test() +{ + return go()()->zerofunc(); +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00095/00095.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00095/00095.c new file mode 100644 index 00000000..c321df48 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00095/00095.c @@ -0,0 +1,30 @@ +int x; +int x = 3; +int x; + +int main(); + +void * +foo() +{ + return &main; +} + +int +test() +{ + if (x != 3) + return 0; + + x = 0; + return x; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00124/00124.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00124/00124.c new file mode 100644 index 00000000..4afc3d2d --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00124/00124.c @@ -0,0 +1,30 @@ +int +f2(int c, int b) +{ + return c - b; +} + +int (* +f1(int a, int b))(int c, int b) +{ + if (a != b) + return f2; + return 0; +} + +int +test() +{ + int (* (*p)(int a, int b))(int c, int d) = f1; + + + return (*(*p)(0, 2))(2, 2); +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00159/00159.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00159/00159.c new file mode 100644 index 00000000..ccdf63de --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00159/00159.c @@ -0,0 +1,43 @@ +#include + +int myfunc(int x) +{ + return x * x; +} + +void vfunc(int a) +{ + printf("a=%d\n", a); +} + +void qfunc() +{ + printf("qfunc()\n"); +} + +void zfunc() +{ + ((void (*)(void))0) (); +} + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00170/00170.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00170/00170.c new file mode 100644 index 00000000..2bd8767d --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00170/00170.c @@ -0,0 +1,80 @@ +#include + +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 test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/complex_types/funptr/00189/00189.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00189/00189.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/funptr/00189/00189.c rename to project/tests/in_progress/for_main/bad/types/composite_types/funptr/00189/00189.c diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00209/00209.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00209/00209.c new file mode 100644 index 00000000..a261b970 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00209/00209.c @@ -0,0 +1,48 @@ +/* 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); + +#include +int main () { + printf("OK\n"); + return 0; +} diff --git a/project/tests/in_progress/for_main/bad/complex_types/funptr/00210/00210.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00210/00210.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/funptr/00210/00210.c rename to project/tests/in_progress/for_main/bad/types/composite_types/funptr/00210/00210.c diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00219/00219.c b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00219/00219.c new file mode 100644 index 00000000..4804f659 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/funptr/00219/00219.c @@ -0,0 +1,72 @@ +#include + +const int a = 0; + +struct a { + int a; +}; + +struct b { + int a; +}; + +int a_f() +{ + return 20; +} + +int b_f() +{ + return 10; +} + +typedef int (*fptr)(int); +int foo(int i) +{ + return i; +} + +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); + i = _Generic(foo, fptr: 3, int: 4); + printf("%d\n", i); + return 0; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00013/00013.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00013/00013.c new file mode 100644 index 00000000..3e9b19fc --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00013/00013.c @@ -0,0 +1,18 @@ +int +test() +{ + int x; + int *p; + + x = 0; + p = &x; + return p[0]; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00014/00014.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00014/00014.c new file mode 100644 index 00000000..3b8abc9f --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00014/00014.c @@ -0,0 +1,19 @@ +int +test() +{ + int x; + int *p; + + x = 1; + p = &x; + p[0] = 0; + return x; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00026/00026.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00026/00026.c new file mode 100644 index 00000000..94433ae9 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00026/00026.c @@ -0,0 +1,17 @@ +int +test() +{ + char *p; + + p = "hello"; + return p[0] - 104; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00032/00032.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00032/00032.c new file mode 100644 index 00000000..8f705314 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00032/00032.c @@ -0,0 +1,38 @@ +int +test() +{ + int arr[2]; + int *p; + + arr[0] = 2; + arr[1] = 3; + p = &arr[0]; + if(*(p++) != 2) + return 1; + if(*(p++) != 3) + return 2; + + p = &arr[1]; + if(*(p--) != 3) + return 1; + if(*(p--) != 2) + return 2; + + p = &arr[0]; + if(*(++p) != 3) + return 1; + + p = &arr[1]; + if(*(--p) != 2) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00037/00037.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00037/00037.c new file mode 100644 index 00000000..4b1f51a4 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00037/00037.c @@ -0,0 +1,25 @@ +int +test() +{ + int x[2]; + int *p; + + x[1] = 7; + p = &x[0]; + p = p + 1; + + if(*p != 7) + return 1; + if(&x[1] - &x[0] != 1) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00072/00072.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00072/00072.c new file mode 100644 index 00000000..500f703a --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00072/00072.c @@ -0,0 +1,22 @@ +int +test() +{ + int arr[2]; + int *p; + + p = &arr[0]; + p += 1; + *p = 123; + + if(arr[1] != 123) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00073/00073.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00073/00073.c new file mode 100644 index 00000000..a76f6499 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00073/00073.c @@ -0,0 +1,22 @@ +int +test() +{ + int arr[2]; + int *p; + + p = &arr[1]; + p -= 1; + *p = 123; + + if(arr[0] != 123) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00130/00130.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00130/00130.c new file mode 100644 index 00000000..14a59566 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00130/00130.c @@ -0,0 +1,30 @@ +int +test() +{ + char arr[2][4], (*p)[4], *q; + int v[4]; + + p = arr; + q = &arr[1][3]; + arr[1][3] = 2; + v[0] = 2; + + if (arr[1][3] != 2) + return 1; + if (p[1][3] != 2) + return 1; + if (*q != 2) + return 1; + if (*v != 2) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00149/00149.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00149/00149.c new file mode 100644 index 00000000..12f1029e --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00149/00149.c @@ -0,0 +1,20 @@ +struct S { int a; int b; }; +struct S *s = &(struct S) { 1, 2 }; + +int +test() +{ + if(s->a != 1) + return 1; + if(s->b != 2) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00163/00163.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00163/00163.c new file mode 100644 index 00000000..abfea3b1 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/00163/00163.c @@ -0,0 +1,48 @@ +#include + +struct ziggy +{ + int a; + int b; + int c; +} bolshevic; + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr01/char_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr01/char_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr01/char_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr01/char_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr02/char_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr02/char_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr02/char_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr02/char_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr03/char_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr03/char_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/char/char_ptr03/char_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/char/char_ptr03/char_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/local_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/local_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers07.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers07.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/other/pointers07.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/other/pointers07.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr01/char_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr01/char_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr01/char_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr01/char_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr02/char_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr02/char_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr02/char_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr02/char_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr03/char_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr03/char_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/char/char_ptr03/char_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/char/char_ptr03/char_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/double/double_ptr02/double_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/double/double_ptr02/double_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/double/double_ptr02/double_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/double/double_ptr02/double_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/int/int_ptr02/int_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/int/int_ptr02/int_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/int/int_ptr02/int_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/int/int_ptr02/int_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/long_long/long_long_ptr02/long_long_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/long_long/long_long_ptr02/long_long_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/long_long/long_long_ptr02/long_long_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/long_long/long_long_ptr02/long_long_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/short/short_ptr02/short_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/short/short_ptr02/short_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/short/short_ptr02/short_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/short/short_ptr02/short_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr01/uint_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr01/uint_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr01/uint_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr01/uint_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr02/uint_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr02/uint_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr02/uint_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr02/uint_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr03/uint_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr03/uint_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_int/uint_ptr03/uint_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_int/uint_ptr03/uint_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr01/ulonglong_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonglong_ptr03/ulonglong_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_long_long/ulonnglong_ptr02/ulonglong_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr01/ushort_ptr01.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr01/ushort_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr01/ushort_ptr01.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr01/ushort_ptr01.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr02/ushort_ptr02.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr02/ushort_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr02/ushort_ptr02.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr02/ushort_ptr02.c diff --git a/project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr03/ushort_ptr03.c b/project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr03/ushort_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/complex_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr03/ushort_ptr03.c rename to project/tests/in_progress/for_main/bad/types/composite_types/pointers/simple_types_ptr/unsigned_short/ushort_ptr03/ushort_ptr03.c diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/struct/00050/00050.c b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00050/00050.c new file mode 100644 index 00000000..2ae242f8 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00050/00050.c @@ -0,0 +1,41 @@ +struct S1 { + int a; + int b; +}; + +struct S2 { + int a; + int b; + union { + int c; + int d; + }; + struct S1 s; +}; + +struct S2 v = {1, 2, 3, {4, 5}}; + +int +test() +{ + if(v.a != 1) + return 1; + if(v.b != 2) + return 2; + if(v.c != 3 || v.d != 3) + return 3; + if(v.s.a != 4) + return 4; + if(v.s.b != 5) + return 5; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/struct/00053/00053.c b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00053/00053.c new file mode 100644 index 00000000..63a6c9f3 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00053/00053.c @@ -0,0 +1,21 @@ +int +test() +{ + struct T { int x; } s1; + s1.x = 1; + { + struct T { int y; } s2; + s2.y = 1; + if (s1.x - s2.y != 0) + return 1; + } + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/struct/00091/00091.c b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00091/00091.c new file mode 100644 index 00000000..5ed5e364 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00091/00091.c @@ -0,0 +1,27 @@ +typedef struct { + int v; + int sub[2]; +} S; + +S a[1] = {{1, {2, 3}}}; + +int +test() +{ + if (a[0].v != 1) + return 1; + if (a[0].sub[0] != 2) + return 2; + if (a[0].sub[1] != 3) + return 3; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/struct/00150/00150.c b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00150/00150.c new file mode 100644 index 00000000..8bbefb22 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/struct/00150/00150.c @@ -0,0 +1,41 @@ +struct S1 { + int a; + int b; +}; +struct S2 { + struct S1 s1; + struct S1 *ps1; + int arr[2]; +}; +struct S1 gs1 = { .a = 1, 2 }; +struct S2 *s = &(struct S2) { + {.b = 2, .a = 1}, + &gs1, + {[0] = 1, 1+1} +}; + +int +test() +{ + if(s->s1.a != 1) + return 1; + if(s->s1.b != 2) + return 2; + if(s->ps1->a != 1) + return 3; + if(s->ps1->b != 2) + return 4; + if(s->arr[0] != 1) + return 5; + if(s->arr[1] != 2) + return 6; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/composite_types/struct/trian/trian01.c b/project/tests/in_progress/for_main/bad/types/composite_types/struct/trian/trian01.c new file mode 100644 index 00000000..d4d46ee5 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/composite_types/struct/trian/trian01.c @@ -0,0 +1,10 @@ +#include + +struct Triangle{int a, b, c;} t = {.a = 3, .c = 5}; + + +int main() { + t.b = 4; + printf("t.a = %d, t.b = %d, t.c = %d\n", t.a, t.b, t.c); + return 0; +} diff --git a/project/tests/in_progress/for_main/bad/types/type_casting/00104/00104.c b/project/tests/in_progress/for_main/bad/types/type_casting/00104/00104.c new file mode 100644 index 00000000..70ef242d --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/type_casting/00104/00104.c @@ -0,0 +1,37 @@ +#include +//#include +typedef int int32_t; +typedef long long int64_t; + +int +test() +{ + int32_t x; + int64_t l; + + x = 0; + l = 0; + printf("%d\n", x); + printf("%lld\n", l); + + x = ~x; + printf("%d\n", x); + if (x != 0xffffffff) + return 1; + + l = ~l; + printf("%lld\n", l); + if (x != 0xffffffffffffffff) + return 2; + + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/type_casting/00113/00113.c b/project/tests/in_progress/for_main/bad/types/type_casting/00113/00113.c new file mode 100644 index 00000000..217e7a43 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/type_casting/00113/00113.c @@ -0,0 +1,16 @@ +int +test() +{ + int a = 0; + float f = a + 1; + + return f == a; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/types/type_casting/00128/00128.c b/project/tests/in_progress/for_main/bad/types/type_casting/00128/00128.c new file mode 100644 index 00000000..214c73e8 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/types/type_casting/00128/00128.c @@ -0,0 +1,150 @@ +#include + +int a; +unsigned b; +char c; +signed char d; +unsigned char e; +long f; +signed long g; +// unsigned long g; +long long h; +signed long long i; +// unsigned long long i; +short j; +unsigned short k; + +int +test(void) +{ + a = b; + a = c; + a = d; + a = e; + a = f; + a = g; + a = h; + a = i; + a = j; + a = k; + + b = a; + b = c; + b = d; + b = e; + b = f; + b = g; + b = h; + b = i; + b = j; + b = k; + + c = a; + c = b; + c = d; + c = e; + c = f; + c = g; + c = h; + c = i; + c = j; + c = k; + + d = a; + d = b; + d = c; + d = e; + d = f; + d = g; + d = h; + d = i; + d = j; + d = k; + + e = a; + e = b; + e = c; + e = d; + e = f; + e = g; + e = h; + e = i; + e = j; + e = k; + + f = a; + f = b; + f = c; + f = d; + f = e; + f = g; + f = h; + f = i; + f = j; + f = k; + + g = a; + g = b; + g = c; + g = d; + g = e; + g = f; + g = h; + g = i; + g = j; + g = k; + + h = a; + h = b; + h = c; + h = d; + h = e; + h = f; + h = g; + h = i; + h = j; + h = k; + + i = a; + i = b; + i = c; + i = d; + i = e; + i = f; + i = g; + i = h; + i = j; + i = k; + + j = a; + j = b; + j = c; + j = d; + j = e; + j = f; + j = g; + j = h; + j = i; + j = k; + + k = a; + k = b; + k = c; + k = d; + k = e; + k = f; + k = g; + k = h; + k = j; + k = i; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/base_types/type_casting/type_int32_to_int64d.c b/project/tests/in_progress/for_main/bad/types/type_casting/type_int32_to_int64d.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_casting/type_int32_to_int64d.c rename to project/tests/in_progress/for_main/bad/types/type_casting/type_int32_to_int64d.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_casting/type_int32_to_int64x.c b/project/tests/in_progress/for_main/bad/types/type_casting/type_int32_to_int64x.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_casting/type_int32_to_int64x.c rename to project/tests/in_progress/for_main/bad/types/type_casting/type_int32_to_int64x.c diff --git a/project/tests/in_progress/for_main/bad/base_types/type_casting/type_int64_to_int32d.c b/project/tests/in_progress/for_main/bad/types/type_casting/type_int64_to_int32d.c similarity index 100% rename from project/tests/in_progress/for_main/bad/base_types/type_casting/type_int64_to_int32d.c rename to project/tests/in_progress/for_main/bad/types/type_casting/type_int64_to_int32d.c diff --git a/project/tests/in_progress/for_main/bad/variables/00096/00096.c b/project/tests/in_progress/for_main/bad/variables/00096/00096.c new file mode 100644 index 00000000..6b7f1563 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/variables/00096/00096.c @@ -0,0 +1,20 @@ +int x, x = 3, x; + +int +test() +{ + if (x != 3) + return 0; + + x = 0; + return x; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/variables/00175/00175.c b/project/tests/in_progress/for_main/bad/variables/00175/00175.c new file mode 100644 index 00000000..bd9b09ad --- /dev/null +++ b/project/tests/in_progress/for_main/bad/variables/00175/00175.c @@ -0,0 +1,62 @@ +#include + +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 test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/var/init/double/init_double.c b/project/tests/in_progress/for_main/bad/variables/init/double/init_double.c similarity index 100% rename from project/tests/in_progress/for_main/bad/var/init/double/init_double.c rename to project/tests/in_progress/for_main/bad/variables/init/double/init_double.c diff --git a/project/tests/in_progress/for_main/bad/variables/init/pointer/00045/00045.c b/project/tests/in_progress/for_main/bad/variables/init/pointer/00045/00045.c new file mode 100644 index 00000000..c016dc80 --- /dev/null +++ b/project/tests/in_progress/for_main/bad/variables/init/pointer/00045/00045.c @@ -0,0 +1,24 @@ +int x = 5; +long y = 6; +int *p = &x; + +int +test() +{ + if (x != 5) + return 1; + if (y != 6) + return 2; + if (*p != 5) + return 3; + return 0; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/bad/var/static/00197/00197.c b/project/tests/in_progress/for_main/bad/variables/static/00197/00197.c similarity index 100% rename from project/tests/in_progress/for_main/bad/var/static/00197/00197.c rename to project/tests/in_progress/for_main/bad/variables/static/00197/00197.c diff --git a/project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static01.c b/project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static01.c similarity index 100% rename from project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static01.c rename to project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static01.c diff --git a/project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static02.c b/project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static02.c similarity index 100% rename from project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static02.c rename to project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static02.c diff --git a/project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static03.c b/project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static03.c similarity index 100% rename from project/tests/in_progress/for_main/bad/var/static/some_local_static/some_local_static03.c rename to project/tests/in_progress/for_main/bad/variables/static/some_local_static/some_local_static03.c diff --git a/project/tests/in_progress/for_main/good/functions/extproto03.c b/project/tests/in_progress/for_main/good/functions/extproto03.c new file mode 100644 index 00000000..49803c2a --- /dev/null +++ b/project/tests/in_progress/for_main/good/functions/extproto03.c @@ -0,0 +1,36 @@ +#include + +typedef long long int64; + +int64 max(int64 a, int64 b) { + int64 x; + if(a > b) x = a; + else x = b; + return x; +} + +// Прототипы функций с их определением +// Алиасы не должны появиться. Функции реализуются +int64 min(int64 a, int64 b); +int64 max(int64 a, int64 b); + +int64 x = 10; +int64 y = 7; + +int main() { + int64 result1, result2; + result1 = min(x, y); + result2 = max(x, y); + + printf("%lld\n", result1); + printf("%lld\n", result2); + + return 0; +} + +int64 min(int64 a, int64 b) { + int64 x; + if(a < b) x = a; + else x = b; + return x; +} diff --git a/project/tests/in_progress/for_main/good/operators/switch/switch03.c b/project/tests/in_progress/for_main/good/operators/switch/switch03.c new file mode 100644 index 00000000..591a153d --- /dev/null +++ b/project/tests/in_progress/for_main/good/operators/switch/switch03.c @@ -0,0 +1,67 @@ +#include + +long x; +long w; + +long test_eg(long x, long y, long z) { + long w = 1; + switch (x) { + case 1: + w = y * z; + break; + case 2: + w = y / z; + case 3: + w += z; + break; + case 5: + case 6: + w -= z; + break; + default: + w = 2; + } + return w; +} + +int main() { + x = 0; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 1; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 2; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 3; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 4; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 5; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 6; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); + + x = 7; + printf("%ld\n", x); + w = test_eg(x, 10, 3); + printf("%ld\n", w); +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00027/00027.c b/project/tests/in_progress/for_main/good/test_suit_good/00027/00027.c new file mode 100644 index 00000000..cab02408 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00027/00027.c @@ -0,0 +1,18 @@ +int +test() +{ + int x; + + x = 1; + x = x | 4; + return x - 5; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00031/00031.c b/project/tests/in_progress/for_main/good/test_suit_good/00031/00031.c new file mode 100644 index 00000000..e83483a1 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00031/00031.c @@ -0,0 +1,56 @@ +int +zero() +{ + return 0; +} + +int +one() +{ + return 1; +} + +int +test() +{ + int x; + int y; + + x = zero(); + y = ++x; + if (x != 1) + return 1; + if (y != 1) + return 1; + + x = one(); + y = --x; + if (x != 0) + return 1; + if (y != 0) + return 1; + + x = zero(); + y = x++; + if (x != 1) + return 1; + if (y != 0) + return 1; + + x = one(); + y = x--; + if (x != 0) + return 1; + if (y != 1) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00033/00033.c b/project/tests/in_progress/for_main/good/test_suit_good/00033/00033.c new file mode 100644 index 00000000..12d3c0f6 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00033/00033.c @@ -0,0 +1,53 @@ +int g; + +int +effect() +{ + g = 1; + return 1; +} + +int +test() +{ + int x; + + g = 0; + x = 0; + if(x && effect()) + return 1; + if(g) + return 2; + x = 1; + if(x && effect()) { + if(g != 1) + return 3; + } else { + return 4; + } + g = 0; + x = 1; + if(x || effect()) { + if(g) + return 5; + } else { + return 6; + } + x = 0; + if(x || effect()) { + if(g != 1) + return 7; + } else { + return 8; + } + return 0; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00042/00042.c b/project/tests/in_progress/for_main/good/test_suit_good/00042/00042.c new file mode 100644 index 00000000..ad0fecca --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00042/00042.c @@ -0,0 +1,19 @@ +int +test() +{ + union { int a; int b; } u; + u.a = 1; + u.b = 3; + + if (u.a != 3 || u.b != 3) + return 1; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00046/00046.c b/project/tests/in_progress/for_main/good/test_suit_good/00046/00046.c new file mode 100644 index 00000000..319a5a50 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00046/00046.c @@ -0,0 +1,41 @@ +typedef struct { + int a; + union { + int b1; + int b2; + }; + struct { union { struct { int c; }; }; }; + struct { + int d; + }; +} s; + +int +test() +{ + s v; + + v.a = 1; + v.b1 = 2; + v.c = 3; + v.d = 4; + + if (v.a != 1) + return 1; + if (v.b1 != 2 && v.b2 != 2) + return 2; + if (v.c != 3) + return 3; + if (v.d != 4) + return 4; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00047/00047.c b/project/tests/in_progress/for_main/good/test_suit_good/00047/00047.c new file mode 100644 index 00000000..ac1f60b0 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00047/00047.c @@ -0,0 +1,22 @@ +struct { int a; int b; int c; } s = {1, 2, 3}; + +int +test() +{ + if (s.a != 1) + return 1; + if (s.b != 2) + return 2; + if (s.c != 3) + return 3; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00048/00048.c b/project/tests/in_progress/for_main/good/test_suit_good/00048/00048.c new file mode 100644 index 00000000..b29792bd --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00048/00048.c @@ -0,0 +1,20 @@ +struct S {int a; int b;}; +struct S s = { .b = 2, .a = 1}; + +int +test() +{ + if(s.a != 1) + return 1; + if(s.b != 2) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00049/00049.c b/project/tests/in_progress/for_main/good/test_suit_good/00049/00049.c new file mode 100644 index 00000000..ae5cb117 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00049/00049.c @@ -0,0 +1,22 @@ +int x = 10; + +struct S {int a; int *p;}; +struct S s = { .p = &x, .a = 1}; + +int +test() +{ + if(s.a != 1) + return 1; + if(*s.p != 10) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00054/00054.c b/project/tests/in_progress/for_main/good/test_suit_good/00054/00054.c new file mode 100644 index 00000000..2acb9b52 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00054/00054.c @@ -0,0 +1,30 @@ +enum E { + x, + y, + z, +}; + +int +test() +{ + enum E e; + + if(x != 0) + return 1; + if(y != 1) + return 2; + if(z != 2) + return 3; + + e = x; + return e; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00055/00055.c b/project/tests/in_progress/for_main/good/test_suit_good/00055/00055.c new file mode 100644 index 00000000..26f973aa --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00055/00055.c @@ -0,0 +1,30 @@ +enum E { + x, + y = 2, + z, +}; + +int +test() +{ + enum E e; + + if(x != 0) + return 1; + if(y != 2) + return 2; + if(z != 3) + return 3; + + e = x; + return e; +} + + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00059/00059.c b/project/tests/in_progress/for_main/good/test_suit_good/00059/00059.c new file mode 100644 index 00000000..eb6f5ec8 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00059/00059.c @@ -0,0 +1,16 @@ +int +test() +{ + if ('a' != 97) + return 1; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00090/00090.c b/project/tests/in_progress/for_main/good/test_suit_good/00090/00090.c new file mode 100644 index 00000000..f1142078 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00090/00090.c @@ -0,0 +1,22 @@ +int a[3] = {0, 1, 2}; + +int +test() +{ + if (a[0] != 0) + return 1; + if (a[1] != 1) + return 2; + if (a[2] != 2) + return 3; + + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00098/00098.c b/project/tests/in_progress/for_main/good/test_suit_good/00098/00098.c new file mode 100644 index 00000000..221e20c2 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00098/00098.c @@ -0,0 +1,13 @@ +int +test() +{ + return L'\0'; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00101/00101.c b/project/tests/in_progress/for_main/good/test_suit_good/00101/00101.c new file mode 100644 index 00000000..8896024e --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00101/00101.c @@ -0,0 +1,18 @@ +int +test() +{ + int c; + c = 0; + do + ; + while (0); + return c; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00112/00112.c b/project/tests/in_progress/for_main/good/test_suit_good/00112/00112.c new file mode 100644 index 00000000..fae3a9e0 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00112/00112.c @@ -0,0 +1,13 @@ +int +test() +{ + return "abc" == (void *)0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00115/00115.c b/project/tests/in_progress/for_main/good/test_suit_good/00115/00115.c new file mode 100644 index 00000000..16cc1cdb --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00115/00115.c @@ -0,0 +1,25 @@ +#define B "b" + +char s[] = "a" B "c"; + +int +test() +{ + if (s[0] != 'a') + return 1; + if (s[1] != 'b') + return 2; + if (s[2] != 'c') + return 3; + if (s[3] != '\0') + return 4; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00117/00117.c b/project/tests/in_progress/for_main/good/test_suit_good/00117/00117.c new file mode 100644 index 00000000..d78ce765 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00117/00117.c @@ -0,0 +1,13 @@ +int test() +{ + int x[] = { 1, 0 }; + return x[1]; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00118/00118.c b/project/tests/in_progress/for_main/good/test_suit_good/00118/00118.c new file mode 100644 index 00000000..7f783513 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00118/00118.c @@ -0,0 +1,14 @@ +int +test() +{ + struct { int x; } s = { 0 }; + return s.x; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00120/00120.c b/project/tests/in_progress/for_main/good/test_suit_good/00120/00120.c new file mode 100644 index 00000000..92b81c3d --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00120/00120.c @@ -0,0 +1,18 @@ +struct { + enum { X } x; +} s; + + +int +test() +{ + return X; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00125/00125.c b/project/tests/in_progress/for_main/good/test_suit_good/00125/00125.c new file mode 100644 index 00000000..4f2f67b2 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00125/00125.c @@ -0,0 +1,16 @@ +#include + +int +test(void) +{ + printf("hello world\n"); + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00131/00131.c b/project/tests/in_progress/for_main/good/test_suit_good/00131/00131.c new file mode 100644 index 00000000..ca7b1987 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00131/00131.c @@ -0,0 +1,22 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00133/00133.c b/project/tests/in_progress/for_main/good/test_suit_good/00133/00133.c new file mode 100644 index 00000000..4d92648b --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00133/00133.c @@ -0,0 +1,32 @@ +int test(void) +{ + int i; + unsigned u; + + i = 1; + i = -1; + i = -1l; + i = -1u; + i = -1ll; + i = 32766 + 1 & 3; + i = (int) 32768 < 0; + i = -1u < 0; + + u = 1; + u = -1; + u = -1l; + u = -1u; + u = -1ll; + u = (unsigned) 32768 < 0; + u = 32766 + 1 & 3; + u = -1u < 0; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00146/00146.c b/project/tests/in_progress/for_main/good/test_suit_good/00146/00146.c new file mode 100644 index 00000000..a36091ae --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00146/00146.c @@ -0,0 +1,20 @@ +struct S { int a; int b; }; +struct S s = {1, 2}; + +int +test() +{ + if(s.a != 1) + return 1; + if(s.b != 2) + return 2; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00147/00147.c b/project/tests/in_progress/for_main/good/test_suit_good/00147/00147.c new file mode 100644 index 00000000..5f890301 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00147/00147.c @@ -0,0 +1,21 @@ +int arr[3] = {[2] = 2, [0] = 0, [1] = 1}; + +int +test() +{ + if(arr[0] != 0) + return 1; + if(arr[1] != 1) + return 2; + if(arr[2] != 2) + return 3; + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00157/00157.c b/project/tests/in_progress/for_main/good/test_suit_good/00157/00157.c new file mode 100644 index 00000000..d9511c74 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00157/00157.c @@ -0,0 +1,29 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00158/00158.c b/project/tests/in_progress/for_main/good/test_suit_good/00158/00158.c new file mode 100644 index 00000000..151f65bb --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00158/00158.c @@ -0,0 +1,37 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00160/00160.c b/project/tests/in_progress/for_main/good/test_suit_good/00160/00160.c new file mode 100644 index 00000000..41af1008 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00160/00160.c @@ -0,0 +1,32 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00161/00161.c b/project/tests/in_progress/for_main/good/test_suit_good/00161/00161.c new file mode 100644 index 00000000..53a78606 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00161/00161.c @@ -0,0 +1,32 @@ +#include + +int test() +{ + 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; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} + +// vim: set expandtab ts=4 sw=3 sts=3 tw=80 : diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00162/00162.c b/project/tests/in_progress/for_main/good/test_suit_good/00162/00162.c new file mode 100644 index 00000000..1231cfff --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00162/00162.c @@ -0,0 +1,42 @@ +void foo(int [5]); +void fooc(int x[const 5]); +void foos(int x[static 5]); +void foov(int x[volatile 5]); +void foor(int x[restrict 5]); +void fooc(int [const 5]); +void foos(int [static 5]); +void foov(int [volatile 5]); +void foor(int [restrict 5]); +void fooc(int (* const x)); +void foos(int *x); +void foov(int * volatile x); +void foor(int * restrict x); +void fooc(int x[volatile 5]) +{ + x[3] = 42; +#ifdef INVALID + x = 0; +#endif +} +void foovm(int x[const *]); +void foovm(int * const x); +#ifdef INVALID +void wrongc(int x[3][const 4]); +void wrongvm(int x[static *]); +void foovm(int x[const *]) +{ + x[2] = 1; +} +#endif +int test() +{ + return 0; +} + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00164/00164.c b/project/tests/in_progress/for_main/good/test_suit_good/00164/00164.c new file mode 100644 index 00000000..59372170 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00164/00164.c @@ -0,0 +1,48 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00165/00165.c b/project/tests/in_progress/for_main/good/test_suit_good/00165/00165.c new file mode 100644 index 00000000..e3b46721 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00165/00165.c @@ -0,0 +1,22 @@ +#include + +#define FRED 12 +#define BLOGGS(x) (12*(x)) + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00166/00166.c b/project/tests/in_progress/for_main/good/test_suit_good/00166/00166.c new file mode 100644 index 00000000..651fddee --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00166/00166.c @@ -0,0 +1,26 @@ +#include + +int test() +{ + int a = 24680; + int b = 01234567; + int c = 0x2468ac; + int d = 0x2468AC; + + printf("%d\n", a); + printf("%d\n", b); + printf("%d\n", c); + printf("%d\n", d); + + return 0; +} + +// vim: set expandtab ts=4 sw=3 sts=3 tw=80 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00167/00167.c b/project/tests/in_progress/for_main/good/test_suit_good/00167/00167.c new file mode 100644 index 00000000..7457b52d --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00167/00167.c @@ -0,0 +1,29 @@ +#include + +int test() +{ + 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 : + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00168/00168.c b/project/tests/in_progress/for_main/good/test_suit_good/00168/00168.c new file mode 100644 index 00000000..697c60c7 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00168/00168.c @@ -0,0 +1,29 @@ +#include + +int factorial(int i) +{ + if (i < 2) + return i; + else + return i * factorial(i - 1); +} + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00169/00169.c b/project/tests/in_progress/for_main/good/test_suit_good/00169/00169.c new file mode 100644 index 00000000..09b666d6 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00169/00169.c @@ -0,0 +1,29 @@ +#include + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00171/00171.c b/project/tests/in_progress/for_main/good/test_suit_good/00171/00171.c new file mode 100644 index 00000000..e50a9723 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00171/00171.c @@ -0,0 +1,38 @@ +#include + +#define NULL 0 + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00172/00172.c b/project/tests/in_progress/for_main/good/test_suit_good/00172/00172.c new file mode 100644 index 00000000..56307b47 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00172/00172.c @@ -0,0 +1,32 @@ +#include + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00177c/00177.c b/project/tests/in_progress/for_main/good/test_suit_good/00177c/00177.c new file mode 100644 index 00000000..78784429 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00177c/00177.c @@ -0,0 +1,25 @@ +#include + +int test() +{ + 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 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00185i/00185.c b/project/tests/in_progress/for_main/good/test_suit_good/00185i/00185.c new file mode 100644 index 00000000..42d001ea --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00185i/00185.c @@ -0,0 +1,36 @@ +#include + +int test() +{ + int Count; + + int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 }; + + int tmpVal; + for (Count = 0; Count < 10; Count++) { + tmpVal = Array[Count]; + printf("%d\n", Count); + printf("%d\n", tmpVal); + } + + int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, }; + + for (Count = 0; Count < 10; Count++) { + tmpVal = Array2[Count]; + printf("%d\n", Count); + printf("%d\n", tmpVal); +// printf("%d: %d\n", Count, Array2[Count]); + } + + return 0; +} + +/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00185l/00185.c b/project/tests/in_progress/for_main/good/test_suit_good/00185l/00185.c new file mode 100644 index 00000000..a02d4cfc --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00185l/00185.c @@ -0,0 +1,36 @@ +#include + +long test() +{ + long Count; + + long Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 }; + + long tmpVal; + for (Count = 0; Count < 10; Count++) { + tmpVal = Array[Count]; + printf("%ld\n", Count); + printf("%ld\n", tmpVal); + } + + long Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, }; + + for (Count = 0; Count < 10; Count++) { + tmpVal = Array2[Count]; + printf("%ld\n", Count); + printf("%ld\n", tmpVal); +// printf("%d: %d\n", Count, Array2[Count]); + } + + return 0; +} + +/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/ + +#include +int main() +{ + int x = test(); + printf("%d\n", x); + return x; +} diff --git a/project/tests/in_progress/for_main/good/test_suit_good/00188/00188.c b/project/tests/in_progress/for_main/good/test_suit_good/00188/00188.c new file mode 100644 index 00000000..58ef0ac6 --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00188/00188.c @@ -0,0 +1,85 @@ +#include + +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/project/tests/in_progress/for_main/good/test_suit_good/00218/00218.c b/project/tests/in_progress/for_main/good/test_suit_good/00218/00218.c new file mode 100644 index 00000000..bb6dc35d --- /dev/null +++ b/project/tests/in_progress/for_main/good/test_suit_good/00218/00218.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/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_ass.c b/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_ass.c new file mode 100644 index 00000000..dd95fbaa --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_ass.c @@ -0,0 +1,18 @@ +#include + +typedef long long int64; +typedef double float64; + +int64 a = 10; +float64 b = 3.141592; + +int main() { + printf("%lld\n", a); + printf("%f\n", b); + + b = a; + printf("%f\n", b); + + return 0; +} + diff --git a/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_expl.c b/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_expl.c new file mode 100644 index 00000000..181a4795 --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/base_types/type_casting/typecast01_i64_to_f64_expl.c @@ -0,0 +1,17 @@ +#include + +typedef long long int64; + +int64 a = 10; +double b = 3.141592; + +int main() { + printf("%lld\n", a); + printf("%f\n", b); + + b = (double)a; + printf("%f\n", b); + + return 0; +} + diff --git a/project/tests/in_progress/for_main/good/array/arr3d/arr3d2.c b/project/tests/in_progress/for_main/good/types/complex_types/array/arr3d/arr3d2.c similarity index 100% rename from project/tests/in_progress/for_main/good/array/arr3d/arr3d2.c rename to project/tests/in_progress/for_main/good/types/complex_types/array/arr3d/arr3d2.c diff --git a/project/tests/in_progress/for_main/good/array/array_formula/array_formula.c b/project/tests/in_progress/for_main/good/types/complex_types/array/array_formula/array_formula.c similarity index 100% rename from project/tests/in_progress/for_main/good/array/array_formula/array_formula.c rename to project/tests/in_progress/for_main/good/types/complex_types/array/array_formula/array_formula.c diff --git a/project/tests/in_progress/for_main/good/array/exchange/exchange01.c b/project/tests/in_progress/for_main/good/types/complex_types/array/exchange/exchange01.c similarity index 100% rename from project/tests/in_progress/for_main/good/array/exchange/exchange01.c rename to project/tests/in_progress/for_main/good/types/complex_types/array/exchange/exchange01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/enum/enum01.c b/project/tests/in_progress/for_main/good/types/complex_types/enum/enum01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/enum/enum01.c rename to project/tests/in_progress/for_main/good/types/complex_types/enum/enum01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/enum/enum02.c b/project/tests/in_progress/for_main/good/types/complex_types/enum/enum02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/enum/enum02.c rename to project/tests/in_progress/for_main/good/types/complex_types/enum/enum02.c diff --git a/project/tests/in_progress/for_main/good/types/complex_types/pointers/full/pointers_full.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/full/pointers_full.c new file mode 100644 index 00000000..86779bb8 --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/complex_types/pointers/full/pointers_full.c @@ -0,0 +1,32 @@ +//clang -Xclang -ast-dump -fsyntax-only main.c +#include + +long long c = 10; +long long d = 255; +long long *pc; +long long *pd; +long long **ppc; +long long **ppd; + +int main() { + pc = &c; + ppc = & pc; + pd = &d; + ppd = & pd; + c = *pc; + c = **ppc; + pc = &c; + d = *&c; + pc = &*&c; + d = *&*&c; + pd = pc; + ppd = ppc; + pd = &*pc; + c = *&*pc; + c = *&**&*ppc; + + printf("%lld\n", c); + printf("%lld\n", d); + + return 0; +} diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr01/uint_ptr01.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr01/uint_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr01/uint_ptr01.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr01/uint_ptr01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr02/uint_ptr02.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr02/uint_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr02/uint_ptr02.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr02/uint_ptr02.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr03/uint_ptr03.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr03/uint_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/local_ptr/unsigned_int/uint_ptr03/uint_ptr03.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/local_ptr/unsigned_int/uint_ptr03/uint_ptr03.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers02.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers02.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers02.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers04.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers04.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers04.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers04.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers05.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers05.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers05.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers05.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers06.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers06.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/other/pointers06.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/other/pointers06.c diff --git a/project/tests/in_progress/for_main/good/types/complex_types/pointers/ptr_arrow/ptr_arrow01.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/ptr_arrow/ptr_arrow01.c new file mode 100644 index 00000000..7983b173 --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/complex_types/pointers/ptr_arrow/ptr_arrow01.c @@ -0,0 +1,27 @@ +//clang -Xclang -ast-dump -fsyntax-only main.c + +#include + +struct s01 { + long long a; +}; + +struct s01 sv; +struct s01 *sp; + +int main() { + sv.a = 10; + long long x; + sp = &sv; + + x = sv.a; + printf("%lld\n", x); + + x = sp->a; + printf("%lld\n", x); + + x = (*sp).a; + printf("%lld\n", x); + + return 0; +} diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr01/struct_ptr01.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr01/struct_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr01/struct_ptr01.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr01/struct_ptr01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr02/struct_ptr02.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr02/struct_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr02/struct_ptr02.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr02/struct_ptr02.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr03/struct_ptr03.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr03/struct_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr03/struct_ptr03.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr03/struct_ptr03.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr04/struct_ptr04.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr04/struct_ptr04.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/struct_ptr/struct_ptr04/struct_ptr04.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/struct_ptr/struct_ptr04/struct_ptr04.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr01/ushort_ptr01.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr01/ushort_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr01/ushort_ptr01.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr01/ushort_ptr01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr02/ushort_ptr02.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr02/ushort_ptr02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr02/ushort_ptr02.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr02/ushort_ptr02.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr03/ushort_ptr03.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr03/ushort_ptr03.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/unsigned_short/ushort_ptr03/ushort_ptr03.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/unsigned_short/ushort_ptr03/ushort_ptr03.c diff --git a/project/tests/in_progress/for_main/good/complex_types/pointers/while_ptr/while_ptr01.c b/project/tests/in_progress/for_main/good/types/complex_types/pointers/while_ptr/while_ptr01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/pointers/while_ptr/while_ptr01.c rename to project/tests/in_progress/for_main/good/types/complex_types/pointers/while_ptr/while_ptr01.c diff --git a/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/rect/rect_expl2_area_fun_i64f64.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/rect/rect_expl2_area_fun_i64f64.c new file mode 100644 index 00000000..54327ec9 --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/rect/rect_expl2_area_fun_i64f64.c @@ -0,0 +1,27 @@ +#include + +typedef long long int64; + +// прямоугольник +struct rectangle { + int64 x, y; // ширина, высота +}; + +struct rectangle r; + +double area(struct rectangle r) { + return (double)r.x * (double)r.y; +} + +int main() { + r.x = 5; + r.y = 10; + + double p; + p = area(r); + + printf("%f\n", p); + + return 0; +} + diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_area_fun_i64f64.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_area_fun_i64f64.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_area_fun_i64f64.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_area_fun_i64f64.c diff --git a/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i32f64_ast_nonamed.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i32f64_ast_nonamed.c new file mode 100644 index 00000000..a83a4030 --- /dev/null +++ b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i32f64_ast_nonamed.c @@ -0,0 +1,58 @@ +#include + +// прямоугольник +struct rectangle { + int x, y; // ширина, высота +}; + +// треугольник +struct triangle { + int a, b, c; // стороны +}; + +// фигура +struct figure { + int key; + union { + struct rectangle r; + struct triangle t; + }; +}; + +int main() { +// f.r = 6; +// f.y = 8; +// f.c = 10; +// +// double p; +// p = circle_perimeter(f.r); +// printf("%f\n", p); +// +// p = rect_perimeter(f.x, f.y); +// printf("%f\n", p); +// +// p = trian_perimeter(f.a, f.b, f.c); +// printf("%f\n", p); +// +// f.key = 0; +// p = figure_perimeter(&f); +// printf("%f\n", p); +// +// f.key = 1; +// p = figure_perimeter(&f); +// printf("%f\n", p); +// +// f.key = 2; +// p = figure_perimeter(&f); +// printf("%f\n", p); +// +// f.key = 3; +// p = figure_perimeter(&f); +// printf("%f\n", p); +// +// f.key = 10; +// p = figure_perimeter(&f); +// printf("%f\n", p); + + return 0; +} diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast_nonamed.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast_nonamed.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast_nonamed.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/figures/union/uni_impl_per_fun_i64f64_ast_nonamed.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/struct00.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/struct00.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/struct00.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/struct00.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/struct01.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/struct01.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/struct01.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/struct01.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/struct02.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/struct02.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/struct02.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/struct02.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/struct03.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/struct03.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/struct03.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/struct03.c diff --git a/project/tests/in_progress/for_main/good/complex_types/struct/struct04.c b/project/tests/in_progress/for_main/good/types/complex_types/struct/struct04.c similarity index 100% rename from project/tests/in_progress/for_main/good/complex_types/struct/struct04.c rename to project/tests/in_progress/for_main/good/types/complex_types/struct/struct04.c diff --git a/project/tests/in_progress/for_main/good/variables/dublicate.c b/project/tests/in_progress/for_main/good/variables/dublicate.c new file mode 100644 index 00000000..ce10c61d --- /dev/null +++ b/project/tests/in_progress/for_main/good/variables/dublicate.c @@ -0,0 +1,29 @@ +#include + +int a; +int b; +int c; +int d; +int e; +int f; + +int e_; +int f_; + +int e_; +int f_; + +int a; +int b; + +int main() { + a = b = c = 5; + d = e = 10; + e_ = f_ = 13; + + printf("a,b,b = %d,%d,%d\n",a,b,c); + printf("d,e = %d,%d\n",d,e); + printf("e_,f_ = %d,%d\n",e_,f_); + + return 0; +} diff --git a/project/tests/in_progress/for_main/good/var/extvar/executable/extvar01.c b/project/tests/in_progress/for_main/good/variables/extvar/executable/extvar01.c similarity index 100% rename from project/tests/in_progress/for_main/good/var/extvar/executable/extvar01.c rename to project/tests/in_progress/for_main/good/variables/extvar/executable/extvar01.c diff --git a/project/tests/in_progress/for_main/good/var/extvar/executable/extvar02.c b/project/tests/in_progress/for_main/good/variables/extvar/executable/extvar02.c similarity index 100% rename from project/tests/in_progress/for_main/good/var/extvar/executable/extvar02.c rename to project/tests/in_progress/for_main/good/variables/extvar/executable/extvar02.c diff --git a/project/tests/in_progress/for_main/good/var/extvar/executable/extvar03.c b/project/tests/in_progress/for_main/good/variables/extvar/executable/extvar03.c similarity index 100% rename from project/tests/in_progress/for_main/good/var/extvar/executable/extvar03.c rename to project/tests/in_progress/for_main/good/variables/extvar/executable/extvar03.c diff --git a/project/tests/in_progress/for_main/good/var/extvar/executable/extvar04.c b/project/tests/in_progress/for_main/good/variables/extvar/executable/extvar04.c similarity index 100% rename from project/tests/in_progress/for_main/good/var/extvar/executable/extvar04.c rename to project/tests/in_progress/for_main/good/variables/extvar/executable/extvar04.c