diff --git a/tcc.h b/tcc.h index 307fc6c5..d2229235 100644 --- a/tcc.h +++ b/tcc.h @@ -505,6 +505,7 @@ struct SymAttr { unsigned short aligned : 5, /* alignment as log2+1 (0 == unspecified) */ packed : 1, + typedef_align : 1, /* alignment came from a typedef'ed type */ weak : 1, visibility : 2, dllexport : 1, @@ -512,7 +513,7 @@ struct SymAttr { dllimport : 1, addrtaken : 1, nodebug : 1, - xxxx : 2; /* not used */ + xxxx : 1; /* not used */ }; /* function attributes or temporary attributes for parsing */ diff --git a/tccgen.c b/tccgen.c index 941e4ed3..49265125 100644 --- a/tccgen.c +++ b/tccgen.c @@ -1177,8 +1177,10 @@ ST_FUNC void vpush_helper_func(int v) /* Merge symbol attributes. */ static void merge_symattr(struct SymAttr *sa, struct SymAttr *sa1) { - if (sa1->aligned && !sa->aligned) + if (sa1->aligned && !sa->aligned) { sa->aligned = sa1->aligned; + sa->typedef_align = sa1->typedef_align; + } sa->packed |= sa1->packed; sa->weak |= sa1->weak; sa->nodebug |= sa1->nodebug; @@ -4000,6 +4002,7 @@ redo: n = MAX_ALIGN; } ad->a.aligned = exact_log2p1(n); + ad->a.typedef_align = 0; if (n != 1 << (ad->a.aligned - 1)) tcc_error("alignment of %d is larger than implemented", n); break; @@ -4226,8 +4229,11 @@ static void struct_layout(CType *type, AttributeDef *ad) } /* some individual align was specified */ #ifdef TCC_TARGET_PE - /* GNU aligned(n) on a field is a minimum, not a way to lower alignment. */ - if (a > align) + /* GNU aligned(n) on a field is a minimum, not a way to lower alignment. + Typedef-level alignment changes the type alignment itself. */ + if (f->a.typedef_align && a) + align = a; + else if (a > align) align = a; #else if (a) @@ -4701,7 +4707,10 @@ do_decl: static void sym_to_attr(AttributeDef *ad, Sym *s) { + int had_aligned = ad->a.aligned; merge_symattr(&ad->a, &s->a); + if (!had_aligned && (s->type.t & VT_TYPEDEF) && s->a.aligned) + ad->a.typedef_align = 1; merge_funcattr(&ad->f, &s->f); } diff --git a/tccrun.c b/tccrun.c index 57c1c26b..77bd001e 100644 --- a/tccrun.c +++ b/tccrun.c @@ -21,6 +21,12 @@ #include "tcc.h" #ifdef _WIN32 #include +# if !defined(_UCRT) && !defined(_ARM_) && !defined(__arm__) && !defined(_ARM64_) && !defined(__aarch64__) && !defined(_ARM64EC_) && !defined(__arm64ec__) +/* MinGW's x86_64 msvcrt headers prefer __p__environ(), but msvcrt.dll exports + _get_environ() directly, which is what the TCC runtime can reliably import. */ +_CRTIMP errno_t __cdecl _get_environ(char ***); +_CRTIMP errno_t __cdecl _get_wenviron(wchar_t ***); +# endif #endif /* only native compiler supports -run */ diff --git a/tests/Makefile b/tests/Makefile index 13fb4715..e8656c40 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -69,9 +69,17 @@ ifneq (,$(filter FreeBSD NetBSD,$(TARGETOS))) TESTS += test1 endif +HOST_WIN_UCRT = no +ifeq ($(TARGETOS),WIN32) +HOST_WIN_UCRT := $(shell printf '#include \n' | $(CC) -dM -E -xc - 2>/dev/null | grep -q '^#define _UCRT' && echo yes || echo no) +endif + TCCTEST_REF = test.ref ifeq ($(ARCH)-$(TARGETOS),arm64-WIN32) TCCTEST_REF = test.ref.win32-arm64 +else ifeq ($(ARCH)-$(TARGETOS)-$(HOST_WIN_UCRT),x86_64-WIN32-yes) +# CLANG64/UCRT generates a different host reference than the msvcrt-backed TCC runtime. +TCCTEST_REF = test.ref.win32-x86_64-ucrt endif RUN_TCC = -run $(TOPSRC)/tcc.c $(TCCFLAGS) diff --git a/tests/test.ref.win32-arm64 b/tests/test.ref.win32-arm64 index 4327e6f4..6f45108e 100644 --- a/tests/test.ref.win32-arm64 +++ b/tests/test.ref.win32-arm64 @@ -294,7 +294,7 @@ aligntest5 sizeof=16 alignof=16 aligntest6 sizeof=16 alignof=16 aligntest7 sizeof=4 alignof=4 aligntest8 sizeof=4096 alignof=4096 -aligntest9 sizeof=16 alignof=8 +aligntest9 sizeof=12 alignof=4 aligntest10 sizeof=16 alignof=8 altest5 sizeof=32 alignof=16 altest6 sizeof=32 alignof=16 diff --git a/tests/test.ref.win32-x86_64-ucrt b/tests/test.ref.win32-x86_64-ucrt new file mode 100644 index 00000000..c25630d3 --- /dev/null +++ b/tests/test.ref.win32-x86_64-ucrt @@ -0,0 +1,1023 @@ +---- whitespace_test ---- +whitspace: +N=2 +aaa=3 +min=4 +len1=1 +len1=1 str[0]=10 +len1=3 +__LINE__ defined +"123 + 456" +1 + +---- macro_test ---- +N=1236 +aaa=4 +min=-1 +s1=hello +s2=hello, world +s3="c" +s4=a1 +B3=1 +onetwothree=123 +A defined +A defined +B not defined +A defined +B1 not defined +test true1 +test trueA +test 2 +123 +__func__ = macro_test +vaarg=1 +vaarg1 +vaarg1=2 +vaarg1=1 2 +func='macro_test' +INT64_MIN=-9223372036854775808 +a=2 +a=8 +hi +tralala +hi +qq=42 +qq1=1 +basefromheader tcctest.c +base tcctest.c +filefromheader tcctest.h +file tcctest.c +print a backslash: \ + +---- recursive_macro_test ---- +43 +fn tcctest.c, line 326, num 123 +fn tcctest.c, line 327, num 123 +fn tcctest.c, line 328, num 123 +rm_field = 0 +rm_field = 0 +rm_field = 0 0 + +---- string_test ---- +string: +ab3c +ABC: +c=r +wc=a 0x1234 c +foo1_string='bar +testa' +test +!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ +fib=3524578 +262144 +524288 +1048576 +2097152 +4194304 +8388608 +16777216 +33554432 +67108864 +134217728 +268435456 +536870912 +1073741824 +string_test2 +b +b +b +z +r +q +p +c +hello +world +bla +one +two +aa +one +ef +yz + +---- expr_test ---- +1 +-1 +-31232132 +-7808033 +-13 +2 +5 +13 +1 +16 +22322 +22319 +6964152 +5580 +-5580 +1073736243 +1 +-1 +15 +0 +22326 +22329 +2790 +-2791 +536868121 +357136 +-22322 +-22321 +22321 +13 +10 +3744 +3 +12 +4 +11 +12 +3 +192 +-13 +-12 +12 +1 1 1 0 + +---- scope_test ---- +g1=1 +g2=2 +g3=3 +g4=4 +g5=2 + +---- scope2_test ---- +exloc: 43 +exloc: 44 +exloc: 45 +exloc: 46 +exloc: 47 +exloc: 48 +exloc: 49 +exloc: 50 +exloc: 51 +exloc: 51 + +---- forward_test ---- +forward ok +forward ok + +---- funcptr_test ---- +12345 +12345 +12346 +sizeof1 = 1 +sizeof2 = 1 +sizeof3 = 8 +sizeof4 = 8 +42 +42 +43 +aligned_function (should be zero): 0 + +---- if_test ---- +if1t: 1 4 0 0 +if1t: 1 6 0 0 +if1t: 1 7 0 0 +if1t: 1 8 0 0 +if1t: 1 12 0 0 0 +if1t: 2 3 0 3 +if1t: 2 5 0 3 +if1t: 2 7 0 3 +if1t: 2 8 0 3 +if1t: 3 2 2 0 +if1t: 3 5 2 0 +if1t: 3 6 2 0 +if1t: 3 8 2 0 +if1t: 3 10 2 0 0 +if1t: 3 12 2 0 0 +if1t: 3 13 2 0 0 +if1t: 3 14 2 0 0 +if1t: 4 1 2 3 +if1t: 4 5 2 3 +if1t: 4 6 2 3 +if1t: 4 7 2 3 +if1t: 4 9 2 3 0 +if1t: 4 10 2 3 0 +if1t: 4 13 2 3 0 +if1t: 4 14 2 3 0 +if2t:ok +if2t:ok2 +if2t:ok3 + +---- loop_test ---- +0123456789 +0123456789 +0123456789 +count=1 +count=2 +count = 123 +12456 +12456 +012456789 + +---- switch_test ---- +aa2b4567ccccc1314 +ullsw:1 +ullsw:2 +ullsw:3 +ullsw:4 +ullsw:5 +llsw:1 +llsw:2 +llsw:3 +llsw:4 +llsw:5 +ucsw:1 +ucsw:1 +ucsw:1 +ucsw:1 +ucsw:2 +ucsw:3 +ucsw:3 +ucsw:3 +ucsw:3 +ucsw:3 +ucsw:3 +scsw:1 +scsw:1 +scsw:1 +scsw:1 +scsw:2 +scsw:3 +scsw:3 +scsw:3 +scsw:3 +scsw:3 +scsw:3 + +---- goto_test ---- + +goto: +0123456789 +label1 +label2 +label3 + +---- enum_test ---- +43 0 2 4 5 6 1000 +b1=1 +enum large: 0 +enum unsigned: ok +enum unsigned: ok + +---- typedef_test ---- +a=1234 +mytype2=2 + +---- struct_test ---- +sizes: 20 8 4 4 +offsets: 12 +st1: 1 2 3 +union1: 2 +union2: 2 +st2: 3 2 1 +str_addr=10 +aligntest1 sizeof=10 alignof=1 +aligntest2 sizeof=16 alignof=4 +aligntest3 sizeof=16 alignof=8 +aligntest4 sizeof=0 alignof=8 +aligntest5 sizeof=16 alignof=16 +aligntest6 sizeof=16 alignof=16 +aligntest7 sizeof=4 alignof=4 +aligntest8 sizeof=4096 alignof=4096 +aligntest9 sizeof=12 alignof=4 +aligntest10 sizeof=16 alignof=8 +altest5 sizeof=32 alignof=16 +altest6 sizeof=32 alignof=16 +altest7 sizeof=8 alignof=16 +sizeof(struct empty) = 0 +alignof(struct empty) = 1 +Large: sizeof=48 +Large: offsetof(compound_head)=32 + +---- array_test ---- +sizeof(a) = 16 +sizeof("a") = 2 +sizeof(__func__) = 11 +sizeof tab 12 +sizeof tab2 24 +1 2 3 + 0 1 10 11 20 21 +sizeof(size_t)=8 +sizeof(ptrdiff_t)=8 + +---- expr_ptr_test ---- +diff=10 +inc=1 +dec=0 +inc=1 +dec=0 +add=3 +add=3 +FFFFFFFFFFFFFFFC 0000000000000000 1 +0 1 1 1 0 0 +FFFFFFFFFFFFFFFC FFFFFFFFC0000000 -268435455 +0 1 1 1 0 0 +FFFFFFFFFFFFFFFC 00000000B0000000 738197505 +0 1 1 1 0 0 +FFFFFFFFFFFFFFFC 0000000470000000 469762049 +0 1 1 1 0 0 +42 +-1 + +---- bool_test ---- +!s=1 +a=1 +a=0 1 1 +a=0 0 1 +a=1 0 +a1 +a2 +a4 +b=6 +a=400 +exp=1 +r=1 +type of bool: 2147483647 +0 +type of cond: 2147483647 +aspect=65535 +aspect=65536 +34 -1 +60 31 +bits = 0x1 + +---- optimize_out_test ---- +oo:40 +oo:41 +oo:42 +oo:43 +oow:44 +oos:45 +ool1:46 +ool2:47 +ool3:48 +ool5:49 +ool6:50 + +---- expr2_test ---- +res= 112 2 + +---- constant_expr_test ---- +48 +3 +3 +16 + +---- expr_cmp_test ---- +1 +0 +1 +1 +1 +1 +1 +1 +0 +0 +1 +0 +1 +0 + +---- char_short_test ---- +s8=4 -4 +u8=4 252 +s16=772 -516 +u16=772 65020 +s32=16909060 -66052 +u32=16909060 -66052 +var1=1020308 +var1=1020809 +var1=8090a0b +promote char/short assign -85 120 +promote char/short assign VA -85 120 +promote char/short cast VA -85 120 +promote char/short funcret 137 -85 +promote char/short fumcret VA 52685 -4113 0 1 +promote multicast (char)(unsigned char) -9 -9 +promote multicast (unsigned)(int) 2862188664 +promote multicast (unsigned)(char) 4294967177 + +---- init_test ---- +sinit1=2 +sinit2=3 +sinit3=12 1 2 3 +sinit6=12 +sinit7=12 1 2 3 +sinit8=hellotrala +sinit9=1 2 3 +sinit10=1 2 3 +sinit11=1 2 3 10 11 12 +[0][0] = 1 1 1 +[0][1] = 2 2 2 +[1][0] = 3 3 3 +[1][1] = 4 4 4 +[2][0] = 5 5 5 +[2][1] = 6 6 6 +linit1=2 +linit2=3 +linit6=12 +linit8=11 hellotrala +sinit12=hello world +sinit13=24 test1 test2 test3 +sinit14=abc + 1 2 0 0 0 0 0 0 0 0 + 1 2 0 4 0 0 0 3 0 0 + 97 98 99 0 0 0 0 0 0 0 + 2 3 0 0 0 0 4 0 0 0 +1 0 2 0 +linit17=4 +sinit15=12 +sinit16=1 2 +sinit17=a1 4 a2 1 +0 0 14 14 14 14 2 0 a 0 +cix: 2000 2001 2002 2003 2003 0 0 +cix2: 3003 4006 +sizeof cix20 4, cix21 4, sizeof cix22 4 +arrtype1: 1 2 3 +arrtype2: 4 8 +arrtype3: 4 0 0 +arrtype4: 5 6 7 +arrtype5: 12 12 +arrtype6: 12 +sinit23= 8 42 +sinit24=1 +linit18= 1 1 +bf1: 1 0 +bf2: 1 0 +bf3: 1 0 +bf4: 1 0 +bf5[0]: 0 0 +bf5[1]: 1 0 +bf5[2]: 0 0 +bf6[0]: 0 0 +bf6[1]: 1 0 +bf6[2]: 0 0 +bf7[0]: 0 0 +bf7[1]: 1 0 +bf7[2]: 0 0 +bf8[0]: 0 0 +bf8[1]: 1 0 +bf8[2]: 0 0 +bf9[0]: 0 0 +bf9[1]: 0 0 +bf9[2]: 1 0 +bf10[0]: 0 0 +bf10[1]: 0 0 +bf10[2]: 1 0 + +---- compound_literal_test ---- + 1 2 3 +321 +q1=tralala1 +q2=tralala2 +q3=tralala2 +q4=tralala3 + 1 2 3 +1 2 4 +1 2 5 +1 2 6 + +---- kr_test ---- +func1=7 +func2=7 + +---- struct_assign_test ---- +3 4 3 4.500000 +before call: 3 4 +after call: 7 0 +1 +2 1 + +---- cast_test ---- +-1 -1 255 65535 +-1 -1 255 65535 +-1 -1 255 65535 +-127 +1 +sizeof(c) = 1, sizeof((int)c) = 4 +((unsigned)(short)0x0000f000) = 0xfffff000 +((unsigned)(char)0x0000f0f0) = 0xfffffff0 +1 2 +sizeof(+(char)'a') = 4 +sizeof(-(char)'a') = 4 +sizeof(~(char)'a') = 4 +0000000000000001 000000000000F0F0 0000000000000000 00000000FFFFFFF0 +0x80000000 + +---- bitfield_test ---- +sizeof(st1) = 8 +3 -1 15 -8 121 +121 121 +st1.f1 == -1 +st1.f2 == -1 +4886718345 4026531841 120 +st4.y == 1 +st5 = 1 2 3 4 -3 6 +st6.y == 1 + +---- c99_bool_test ---- +sizeof(_Bool) = 1 +cast: 1 0 1 +b = 1 +b = 1 +sizeof(x ? _Bool : _Bool) = 4 (should be sizeof int) + +---- float_test ---- +sizeof(float) = 4 +sizeof(double) = 8 +sizeof(long double) = 8 +testing 'float' +0 1 1 0 0 1 +1.000000 2.500000 3.500000 -1.500000 2.500000 0.400000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +0 1 0 1 1 0 +2.000000 1.500000 3.500000 0.500000 3.000000 1.333333 -2.000000 +3.000000 +3.000000 +4.000000 +0 1 +1 0 0 0 1 1 +1.000000 1.000000 2.000000 0.000000 1.000000 1.000000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +ftof: 234.600006 234.600006 234.600006 +ftoi: 234 234 234 234 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985531201716224.000000 +ulltof: 17375807653627822000.000000 +ftof: -2334.600098 -2334.600098 -2334.600098 +ftoi: -2334 2334 -2334 2334 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985531201716224.000000 +ulltof: 17375807653627822000.000000 +float: 42.123455 +double: 42.123455 +long double: 42.123455 +strtof: 1.200000 +Test 1.0 / x != 1.0 / y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -x returns 1 (should be 1). +Test 1.0 / x != 1.0 / +y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -y returns 0 (should be 0). +testing 'double' +0 1 1 0 0 1 +1.000000 2.500000 3.500000 -1.500000 2.500000 0.400000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +0 1 0 1 1 0 +2.000000 1.500000 3.500000 0.500000 3.000000 1.333333 -2.000000 +3.000000 +3.000000 +4.000000 +0 1 +1 0 0 0 1 1 +1.000000 1.000000 2.000000 0.000000 1.000000 1.000000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +ftof: 234.600006 234.600000 234.600000 +ftoi: 234 234 234 234 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985529205302080.000000 +ulltof: 17375808098308006000.000000 +ftof: -2334.600098 -2334.600000 -2334.600000 +ftoi: -2334 2334 -2334 2334 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985529205302080.000000 +ulltof: 17375808098308006000.000000 +float: 42.123455 +double: 42.123457 +long double: 42.123457 +strtod: 1.200000 +Test 1.0 / x != 1.0 / y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -x returns 1 (should be 1). +Test 1.0 / x != 1.0 / +y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -y returns 0 (should be 0). +testing 'long double' +0 1 1 0 0 1 +1.000000 2.500000 3.500000 -1.500000 2.500000 0.400000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +0 1 0 1 1 0 +2.000000 1.500000 3.500000 0.500000 3.000000 1.333333 -2.000000 +3.000000 +3.000000 +4.000000 +0 1 +1 0 0 0 1 1 +1.000000 1.000000 2.000000 0.000000 1.000000 1.000000 -1.000000 +2.000000 +2.000000 +3.000000 +0 1 +ftof: 234.600006 234.600000 234.600000 +ftoi: 234 234 234 234 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985529205302080.000000 +ulltof: 17375808098308006000.000000 +ftof: -2334.600098 -2334.600000 -2334.600000 +ftoi: -2334 2334 -2334 2334 +itof: -1234.000000 +utof: 2166572288.000000 +lltof: -81985529205302080.000000 +ulltof: 17375808098308006000.000000 +float: 42.123455 +double: 42.123457 +long double: 42.123457 +strtold: 1.200000 +Test 1.0 / x != 1.0 / y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -x returns 1 (should be 1). +Test 1.0 / x != 1.0 / +y returns 1 (should be 1). +Test 1.0 / x != 1.0 / -y returns 0 (should be 0). +1.200000 3.400000 -5.600000 +2.120000 0.500000 23000000000.000000 +da=123.000000 +fa=123.000000 +da = -294967296.000000 +db = 4000000000.000000 +nan != nan = 1, inf1 = 1.#INF00, inf2 = 1.#INF00 +da subnormal = 0x0.880000p-1022 +da subnormal = 1.1820704873319507e-308 +la subnormal = 0x0.880000p-1022 +la subnormal = 1.1820704873319507e-308 +da/2 subnormal = 0x0.440000p-1022 +da/2 subnormal = 5.9103524366597537e-309 +la/2 subnormal = 0x0.440000p-1022 +la/2 subnormal = 5.9103524366597537e-309 +fa subnormal = 0x1.100000p-127 +fa subnormal = 6.2448137387434024e-039 +la subnormal = 0x1.100000p-127 +la subnormal = 6.2448137387434024e-039 +fa/2 subnormal = 0x1.100000p-128 +fa/2 subnormal = 3.1224068693717012e-039 +la/2 subnormal = 0x1.100000p-128 +la/2 subnormal = 3.1224068693717012e-039 + +---- longlong_test ---- +sizeof(long long) = 8 +-1 4294967294 +1 -2 1 1234567812345679 +-6 +arith: 1023 977 23000 +arith1: 43 11 +bin: 0 1023 1023 +test: 0 1 0 1 1 0 +utest: 0 1 0 1 1 0 +arith2: 1001 24 +arith2: 1001 24 +arith2: 1001 24 +arith2: 1001 24 +not: 0 0 1 1 +arith: 4915 -4405 1188300 +arith1: 0 255 +bin: 52 4863 4811 +test: 0 1 1 0 0 1 +utest: 0 1 1 0 0 1 +arith2: 256 4661 +arith2: 256 4661 +arith2: 256 4661 +arith2: 256 4661 +not: 0 0 1 1 +arith: -782639107 782639101 2347917312 +arith1: 0 -3 +bin: -782639104 -3 782639101 +test: 0 1 0 1 1 0 +utest: 0 1 0 1 1 0 +arith2: -2 -782639103 +arith2: -2 -782639103 +arith2: -2 -782639103 +arith2: -2 -782639103 +not: 0 0 1 1 +shift: 9 9 9312 +shiftc: 36 36 2328 +shiftc: 0 0 9998683865088 +shift: 576460752303423487 -1 -736 +shiftc: 2305843009213693949 -3 -184 +shiftc: 536870911 -1 -790273982464 +shift: 0 0 -1152921504606846976 +shiftc: 245252176896 245252176896 15696139321344 +shiftc: 57 57 -8444530776296390656 +la=320255972942661 ula=16458594985017606144 +lltof: 320255981256704.000000 320255972942661.000000 320255972942661.000000 +ftoll: 320255981256704 320255972942661 320255972942661 +ulltof: 16458595053737083000.000000 16458594985017606000.000000 16458594985017606000.000000 +ftoull: 16458595053737082880 16458594985017606144 16458594985017606144 +12345677 +3 +arith: 2147483648 2147483648 0 +bin: 0 2147483648 2147483648 +test: 0 1 0 1 1 0 +utest: 0 1 0 1 1 0 +arith2: 2147483649 1 +arith2: 2147483649 1 +arith2: 2147483649 1 +arith2: 2147483649 1 +not: 0 0 1 1 +another long long spill test : 2 +a long long function (arm-)reg-args test : -4 +1 0 1 0 +4886718345 +shift: 9 9 9312 +shiftc: 36 36 2328 +shiftc: 0 0 9998683865088 +long long u=2 +long long u=2862188664 +check_opl_save_regs: 1 + +---- manyarg_test ---- +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 987654321986 42.000000 43.000000 +1234567891234.000000 1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 987654321986 42.000000 43.000000 +1 2 3 4 5 6 7 8 1234567891234.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 98765432198642.000000 43.000000 1234567891234.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234.000000 1234567891234 987654321986 42.000000 43.000000 1234567891234.000000 + +---- stdarg_test ---- +1 2 3 +1.000000 2 3.000000 +1234567891234 987654321986 3 1234.000000 +1.200000 2.300000 3.400000 +1 1.200000 3 4.500000 6 7.800000 9 0.100000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 987654321986 42.000000 43.000000 +1234567891234.000000 1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 987654321986 42.000000 43.000000 +1 2 3 4 5 6 7 8 1234567891234.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234 987654321986 42.000000 43.000000 1234567891234.000000 +1 2 3 4 5 6 7 8 0.100000 1.200000 2.300000 3.400000 4.500000 5.600000 6.700000 7.800000 8.900000 9.000000 1234567891234.000000 1234567891234 987654321986 42.000000 43.000000 1234567891234.000000 +stdarg_for_struct: 1 2 3 42 42 42 42 +stdarg_for_libc: string 1.23 456 +stdarg_void_expr: 17 +stdarg_double_struct: -1 +pts[0] = 1 2 +pts[1] = 3 4 +pts[2] = 5 6 +pts[3] = 7 8 +pts[4] = 9 10 +pts[5] = 11 12 +stdarg_double_struct: 1 +pts[0] = 1 2 +d 1 = -1 +pts[2] = 3 4 +pts[3] = 5 6 +pts[4] = 7 8 +pts[5] = 9 10 +pts[6] = 11 12 +stdarg_double_struct: 2 +pts[0] = 1 2 +pts[1] = 3 4 +d 2 = -1 +pts[3] = 5 6 +pts[4] = 7 8 +pts[5] = 9 10 +pts[6] = 11 12 +stdarg_double_struct: 3 +pts[0] = 1 2 +pts[1] = 3 4 +pts[2] = 5 6 +d 3 = -1 +pts[4] = 7 8 +pts[5] = 9 10 +pts[6] = 11 12 +stdarg_double_struct: 4 +pts[0] = 1 2 +pts[1] = 3 4 +pts[2] = 5 6 +pts[3] = 7 8 +d 4 = -1 +pts[5] = 9 10 +pts[6] = 11 12 +stdarg_double_struct: 5 +pts[0] = 1 2 +pts[1] = 3 4 +pts[2] = 5 6 +pts[3] = 7 8 +pts[4] = 9 10 +d 5 = -1 +pts[6] = 11 12 + +---- relocation_test ---- +*rel1=2 +*rel2=3 +in getmyaddress + +---- old_style_function_test ---- +a=1 b=2 b=3.000000 +cmpfn=0 +cmpfn=0 + +---- alloca_test ---- +alloca: p is 123456789012345 +alloca: This is only a test. + + +---- c99_vla_test ---- +Test C99 VLA 1 (sizeof): PASSED +Test C99 VLA 2 (ptrs subtract): PASSED +Test C99 VLA 3 (ptr add): PASSED +Test C99 VLA 4 (ptr access): PASSED +Test C99 VLA 5 (bounds checking (might be disabled)): PASSED PASSED PASSED PASSED PASSED PASSED PASSED PASSED +Test C99 VLA 6 (pointer) + 1 2 3 4 5 + 6 7 8 9 10 + 11 12 13 14 15 + 16 17 18 19 20 + + 21 22 23 24 25 + 26 27 28 29 30 + 31 32 33 34 35 + 36 37 38 39 40 + + 41 42 43 44 45 + 46 47 48 49 50 + 51 52 53 54 55 + 56 57 58 59 60 + + sizes : 80 20 4 + pdiff : 2 3 + tests : 1 1 1 +123 +123 +123 +123 +8 4 123 + +---- sizeof_test ---- +sizeof(int) = 4 +sizeof(unsigned int) = 4 +sizeof(long) = 4 +sizeof(unsigned long) = 4 +sizeof(short) = 2 +sizeof(unsigned short) = 2 +sizeof(char) = 1 +sizeof(unsigned char) = 1 +sizeof(func) = 1 +sizeof(a++) = 4 +a=1 +sizeof(**ptr) = 4 +sizeof(sizeof(int) = 8 +1 0 +__alignof__(int) = 4 +__alignof__(unsigned int) = 4 +__alignof__(short) = 2 +__alignof__(unsigned short) = 2 +__alignof__(char) = 1 +__alignof__(unsigned char) = 1 +__alignof__(func) = 1 +sizeof(char[1+2*a]) = 5 +sizeof( (struct {int i; int j;}){4,5} ) = 8 +sizeof (struct {short i; short j;}){4,5} = 4 +sizeof(t && 0) = 4 +sizeof(1 && 1) = 4 +sizeof(t || 1) = 4 +sizeof(0 || 0) = 4 +sizeof(0, arr) = 8 +sizeof(0, fn) = 8 + +---- typeof_test ---- +a=1.500000 b=2.500000 c=3.500000 + +---- statement_expr_test ---- +a=110 +stmtexpr: somerandomlongstring anotherlongstring +stmtexpr: 40 41 42 +stmtexpr: 43 44 +stmtexpr: 2 should be 2 + +---- local_label_test ---- +bb2 +bb1 +aa2 +aa3 +aa1 +a=2 + +---- asm_test ---- +hello wo +hello wo +mul64=0x1df4d840 +inc64=0x0 +mconstraint: 148 51 52 +set=0x1080fd +swab32(0x01020304) = 0x4030201 +asm_local_statics: 42 +asmbool: failed +fancycpy(43)=43 +fancycpy2(44)=44 +regvar=4243 +asmhc: 0x4542 +asm_dot_test 1: 8 +asm_dot_test 2: 123 +asm_dot_test 3: 456 +asm_dot_test 4: 789 +asm_pcrel_test : 0 + +---- builtin_test ---- +__builtin_types_compatible_p(int, int) = 1 +__builtin_types_compatible_p(int, unsigned int) = 0 +__builtin_types_compatible_p(int, char) = 0 +__builtin_types_compatible_p(int, const int) = 1 +__builtin_types_compatible_p(int, volatile int) = 1 +__builtin_types_compatible_p(int *, int *) = 1 +__builtin_types_compatible_p(int *, void *) = 0 +__builtin_types_compatible_p(int *, const int *) = 0 +__builtin_types_compatible_p(char *, unsigned char *) = 0 +__builtin_types_compatible_p(char *, signed char *) = 0 +__builtin_types_compatible_p(char *, char *) = 1 +__builtin_types_compatible_p(char **, void *) = 0 +res1 = 1 +res2 = 1 +res3 = 0 +res4 = 0 +res5 = 0 +res6 = 0 +res7 = 1 +res8 = 0 +res10 = 1 +res11 = 1 +res12 = 1 +res13 = 0 +bce: 2 +bce: 1 +bce: 8 +bce: 2 +0 2523 +1 2523 +2 4075 +3 1420 +4 1420 +5 3028 +6 1490 +7 1490 +8 3010 +9 2444 +10 2444 +11 3056 +12 16149 +13 16149 +14 32126 +15 547 +16 547 +17 546 + +---- weak_test ---- + +---- global_data_test ---- +43 + +---- cmp_comparison_test ---- + +---- math_cmp_test ---- + +---- callsave_test ---- +callsavetest: 8 +0 + +---- builtin_frame_address_test ---- +str: __builtin_frame_address +bfa1: __builtin_frame_address +bfa2: __builtin_frame_address +bfa3: __builtin_frame_address + +---- volatile_test ---- + ok + +---- attrib_test ---- + +---- bounds_check1_test ---- +0a +0000000000000014 + +---- func_arg_test ---- +0 1 2 3 4 5 6 7 0 +