tinycc/tests/tests2
grischka 1ed20a01c9 bitfields: promote to signed int
For integer promotion with for example arithmetics or
expr_cond (x ? y : z), integral types need to be promoted
to signed if they fit.

According to latest standards, this also applies to bit-field
types taking into account their specific width.

In tcc, VT_BITFIELD set means width < original type width
Field-widths between 33 and 63 are promoted to signed long long
accordingly.

    struct { unsigned long long ullb:35; } s = { 1 };
    #define X (s.ullb - 2)

    int main (void)
    {
        long long Y = X;
        printf("%d %016llx %016llx\n", X < 0, -X, -Y);
        return 0;
    }

Results:
    GCC 4.7 : 0 0000000000000001 FFFFFFF800000001
    MSVC    : 1 0000000000000001 0000000000000001
    TCC     : 1 0000000000000001 0000000000000001

Also, gcc would promote long long bitfields of size < 32
to int as well.  Example:

    struct { unsigned long long x:20; } t = { 123 };
    /* with gcc: */ printf("%d %d\n", t.x, 456);
    /* with tcc: */ printf("%lld %d\n", t.x, 456);
2017-05-09 18:36:24 +02:00
..
00_assignment.c tests2: move into tests 2013-02-05 13:22:36 +01:00
00_assignment.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
01_comment.c tests2: move into tests 2013-02-05 13:22:36 +01:00
01_comment.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
02_printf.c tests2: move into tests 2013-02-05 13:22:36 +01:00
02_printf.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
03_struct.c misc. fixes 2014-01-06 19:56:26 +01:00
03_struct.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
04_for.c tests2: move into tests 2013-02-05 13:22:36 +01:00
04_for.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
05_array.c tests2: move into tests 2013-02-05 13:22:36 +01:00
05_array.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
06_case.c tests2: move into tests 2013-02-05 13:22:36 +01:00
06_case.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
07_function.c tests2: move into tests 2013-02-05 13:22:36 +01:00
07_function.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
08_while.c tests2: move into tests 2013-02-05 13:22:36 +01:00
08_while.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
09_do_while.c tests2: move into tests 2013-02-05 13:22:36 +01:00
09_do_while.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
10_pointer.c tests2: move into tests 2013-02-05 13:22:36 +01:00
10_pointer.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
11_precedence.c tests2: move into tests 2013-02-05 13:22:36 +01:00
11_precedence.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
12_hashdefine.c tests2: move into tests 2013-02-05 13:22:36 +01:00
12_hashdefine.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
13_integer_literals.c tests2: move into tests 2013-02-05 13:22:36 +01:00
13_integer_literals.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
14_if.c tests2: move into tests 2013-02-05 13:22:36 +01:00
14_if.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
15_recursion.c tests2: move into tests 2013-02-05 13:22:36 +01:00
15_recursion.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
16_nesting.c tests2: move into tests 2013-02-05 13:22:36 +01:00
16_nesting.expect tests: cleanup 2013-02-05 14:27:38 +01:00
17_enum.c tests2: move into tests 2013-02-05 13:22:36 +01:00
17_enum.expect tests: cleanup 2013-02-05 14:27:38 +01:00
18_include.c tests2: move into tests 2013-02-05 13:22:36 +01:00
18_include.expect tests: cleanup 2013-02-05 14:27:38 +01:00
18_include.h tests: cleanup 2013-02-05 14:27:38 +01:00
19_pointer_arithmetic.c tests2: move into tests 2013-02-05 13:22:36 +01:00
19_pointer_arithmetic.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
20_pointer_comparison.c tests2: move into tests 2013-02-05 13:22:36 +01:00
20_pointer_comparison.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
21_char_array.c tests2: move into tests 2013-02-05 13:22:36 +01:00
21_char_array.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
22_floating_point.c tests2: move into tests 2013-02-05 13:22:36 +01:00
22_floating_point.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
23_type_coercion.c tests2: move into tests 2013-02-05 13:22:36 +01:00
23_type_coercion.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
24_math_library.c round() in test (24_math_library) fail because there are no defs included. 2015-01-05 18:23:32 +03:00
24_math_library.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
25_quicksort.c tests2: move into tests 2013-02-05 13:22:36 +01:00
25_quicksort.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
26_character_constants.c tests2: move into tests 2013-02-05 13:22:36 +01:00
26_character_constants.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
27_sizeof.c tccgen.c: Try to make sizeof(!x) work. 2015-11-22 00:00:36 +00:00
27_sizeof.expect tccgen.c: Try to make sizeof(!x) work. 2015-11-22 00:00:36 +00:00
28_strings.c Use ISO C string functions instead of obsolete BSD ones that used to be in strings.h. It allows more systems -- i.e. Windows -- to use those tests 2016-10-12 06:18:38 +02:00
28_strings.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
29_array_address.c tests2: move into tests 2013-02-05 13:22:36 +01:00
29_array_address.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
30_hanoi.c tests2: fix 30_hanoi test and enable it. 2014-04-12 13:37:37 -04:00
30_hanoi.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
31_args.c tests2: cleanup 2014-04-07 11:20:45 +02:00
31_args.expect tests2: cleanup 2014-04-07 11:20:45 +02:00
32_led.c tests2: move into tests 2013-02-05 13:22:36 +01:00
32_led.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
33_ternary_op.c tests2: move into tests 2013-02-05 13:22:36 +01:00
33_ternary_op.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
34_array_assignment.c tests2: move into tests 2013-02-05 13:22:36 +01:00
34_array_assignment.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
35_sizeof.c tests2: move into tests 2013-02-05 13:22:36 +01:00
35_sizeof.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
36_array_initialisers.c tests2: move into tests 2013-02-05 13:22:36 +01:00
36_array_initialisers.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
37_sprintf.c tests2: move into tests 2013-02-05 13:22:36 +01:00
37_sprintf.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
38_multiple_array_index.c tests2: move into tests 2013-02-05 13:22:36 +01:00
38_multiple_array_index.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
39_typedef.c tccgen.c: In parse_btype, handle type qualifiers applied to arrays. 2016-01-11 07:51:58 +00:00
39_typedef.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
40_stdio.c tests2: move into tests 2013-02-05 13:22:36 +01:00
40_stdio.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
41_hashif.c tests2: move into tests 2013-02-05 13:22:36 +01:00
41_hashif.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
42_function_pointer.c Fix gawk miscompile 2016-12-18 05:20:14 +01:00
42_function_pointer.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
43_void_param.c tests2: move into tests 2013-02-05 13:22:36 +01:00
43_void_param.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
44_scoped_declarations.c tests: cleanup 2013-02-05 14:27:38 +01:00
44_scoped_declarations.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
45_empty_for.c tests: cleanup 2013-02-05 14:27:38 +01:00
45_empty_for.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
46_grep.c Turn on a implicit-function-declaration warning by default. 2015-03-03 16:32:25 +03:00
46_grep.expect tests2: fix and enable 46_grep test. 2014-04-12 14:04:10 -04:00
47_switch_return.c tests2: move into tests 2013-02-05 13:22:36 +01:00
47_switch_return.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
48_nested_break.c tests2: move into tests 2013-02-05 13:22:36 +01:00
48_nested_break.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
49_bracket_evaluation.c tests2: move into tests 2013-02-05 13:22:36 +01:00
49_bracket_evaluation.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
50_logical_second_arg.c tests: cleanup 2013-02-05 14:27:38 +01:00
50_logical_second_arg.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
51_static.c tests2: move into tests 2013-02-05 13:22:36 +01:00
51_static.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
52_unnamed_enum.c tests2: move into tests 2013-02-05 13:22:36 +01:00
52_unnamed_enum.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
54_goto.c tests: cleanup 2013-02-05 14:27:38 +01:00
54_goto.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
55_lshift_type.c tests2: move into tests 2013-02-05 13:22:36 +01:00
55_lshift_type.expect tests2: move into tests 2013-02-05 13:22:36 +01:00
56_btype_excess-1.c Add test for previous commit 2014-03-25 20:54:19 +08:00
56_btype_excess-1.expect Add test for previous commit 2014-03-25 20:54:19 +08:00
57_btype_excess-2.c Add test for previous commit 2014-03-25 20:54:19 +08:00
57_btype_excess-2.expect Add test for previous commit 2014-03-25 20:54:19 +08:00
58_function_redefinition.c Add tests for previous fixes 2014-03-30 12:56:55 +08:00
58_function_redefinition.expect Add tests for previous fixes 2014-03-30 12:56:55 +08:00
59_function_array.c Add tests for previous fixes 2014-03-30 12:56:55 +08:00
59_function_array.expect Add tests for previous fixes 2014-03-30 12:56:55 +08:00
60_enum_redefinition.c Add tests for previous fixes 2014-03-30 12:56:55 +08:00
60_enum_redefinition.expect Add tests for previous fixes 2014-03-30 12:56:55 +08:00
61_undefined_enum.c Add tests for previous fixes 2014-03-30 12:56:55 +08:00
61_undefined_enum.expect Fix type parsing 2016-03-24 15:44:01 +01:00
62_enumerator_redefinition.c Add tests for previous fixes 2014-03-30 12:56:55 +08:00
62_enumerator_redefinition.expect Add tests for previous fixes 2014-03-30 12:56:55 +08:00
63_local_enumerator_redefinition.c Allow local redefinition of enumerator 2014-03-31 22:59:10 +08:00
63_local_enumerator_redefinition.expect Allow local redefinition of enumerator 2014-03-31 22:59:10 +08:00
64_macro_nesting.c Turn on a implicit-function-declaration warning by default. 2015-03-03 16:32:25 +03:00
64_macro_nesting.expect Add new tests for macro nesting 2014-04-07 23:30:57 +08:00
67_macro_concat.c Fix preprocessor concat with empty arg 2014-04-12 16:11:42 +08:00
67_macro_concat.expect Fix preprocessor concat with empty arg 2014-04-12 16:11:42 +08:00
70_floating_point_literals.c Fix parsing of binary floating point number 2014-12-15 16:32:08 +08:00
70_floating_point_literals.expect Fix parsing of binary floating point number 2014-12-15 16:32:08 +08:00
71_macro_empty_arg.c Fix macro expansion of empty args. 2015-01-18 22:00:10 +01:00
71_macro_empty_arg.expect Fix macro expansion of empty args. 2015-01-18 22:00:10 +01:00
72_long_long_constant.c tccpp: fix issues, add tests 2015-05-09 14:29:39 +02:00
72_long_long_constant.expect tccpp: fix issues, add tests 2015-05-09 14:29:39 +02:00
73_arm64.c arm64: Optimise some integer operations with a constant operand. 2015-03-07 17:42:08 +00:00
73_arm64.expect arm64: Optimise some integer operations with a constant operand. 2015-03-07 17:42:08 +00:00
74_nocode_wanted.c Add some missing nocode_wanted guard 2015-03-10 23:27:14 +08:00
74_nocode_wanted.expect Add some missing nocode_wanted guard 2015-03-10 23:27:14 +08:00
75_array_in_struct_init.c A right fix for the array in struct initialization w/o '{' 2015-03-23 08:27:16 +03:00
75_array_in_struct_init.expect A right fix for the array in struct initialization w/o '{' 2015-03-23 08:27:16 +03:00
76_dollars_in_identifiers.c add missing test from -fdollar-in-identifiers commit 2015-04-20 12:03:45 +01:00
76_dollars_in_identifiers.expect add missing test from -fdollar-in-identifiers commit 2015-04-20 12:03:45 +01:00
77_push_pop_macro.c a test for the #pragma push/pop_macro 2015-04-25 15:03:50 +03:00
77_push_pop_macro.expect a test for the #pragma push/pop_macro 2015-04-25 15:03:50 +03:00
78_vla_label.c tccgen.c: Bug fix for 992cbda and 3ff77a1: set nocode_wanted. 2015-11-21 23:58:58 +00:00
78_vla_label.expect tccgen.c: Bug fix for 992cbda and 3ff77a1: set nocode_wanted. 2015-11-21 23:58:58 +00:00
79_vla_continue.c tests/tests2/79_vla_continue.c: Fix off-by-one error. 2015-11-13 21:49:29 +00:00
79_vla_continue.expect VLA fix: save stack pointer right after modification 2015-04-28 09:23:29 +00:00
80_flexarray.c tccgen.c: Fix flex array members some more 2016-03-11 22:35:44 +01:00
80_flexarray.expect tccgen.c: Fix flex array members some more 2016-03-11 22:35:44 +01:00
81_types.c Reorganize type parsing 2017-05-02 03:07:36 +02:00
81_types.expect Fix type parsing 2016-03-24 15:44:01 +01:00
82_attribs_position.c tccgen.c: Allow type attributes to prefix enum/struct/union name 2016-04-06 14:32:52 +03:00
82_attribs_position.expect tccgen.c: Allow type attributes to prefix enum/struct/union name 2016-04-06 14:32:52 +03:00
83_utf8_in_identifiers.c utf8 in identifiers 2016-04-05 13:05:09 +03:00
83_utf8_in_identifiers.expect utf8 in identifiers 2016-04-05 13:05:09 +03:00
84_hex-float.c updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
84_hex-float.expect updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
85_asm-outside-function.c updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
85_asm-outside-function.expect updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
86_memory-model.c updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
86_memory-model.expect updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
87_dead_code.c opt: Start optimizing dead code a bit 2016-12-15 17:47:12 +01:00
87_dead_code.expect opt: Start optimizing dead code a bit 2016-12-15 17:47:12 +01:00
88_codeopt.c Fix some code suppression fallout 2016-12-20 04:58:34 +01:00
88_codeopt.expect Fix some code suppression fallout 2016-12-20 04:58:34 +01:00
89_nocode_wanted.c updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
89_nocode_wanted.expect updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
90_struct-init.c struct-init: Fix zero initialization with multi-level designators 2017-05-06 05:28:13 +02:00
90_struct-init.expect struct-init: Fix zero initialization with multi-level designators 2017-05-06 05:28:13 +02:00
91_ptr_longlong_arith32.c updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
91_ptr_longlong_arith32.expect updates & cleanups (tcc-doc/Changelog/TODO ...) 2017-02-13 19:03:29 +01:00
92_enum_bitfield.c Fix unsigned enum bit-fields 2017-05-05 23:16:43 +02:00
92_enum_bitfield.expect Fix unsigned enum bit-fields 2017-05-05 23:16:43 +02:00
93_integer_promotion.c bitfields: promote to signed int 2017-05-09 18:36:24 +02:00
93_integer_promotion.expect bitfields: promote to signed int 2017-05-09 18:36:24 +02:00
LICENSE tests2: move into tests 2013-02-05 13:22:36 +01:00
Makefile final adjustments for release 2017-04-25 21:01:54 +02:00