tcc-x86_64 report

tcc-x86_64


tcc-x86_64 version:
tcc version 0.9.27 (x86_64 Linux)
test date: 2019-05-15

single-exec


Test summary:

pass 209
fail 11
skip 0
---------
total 220

not ok ./tests/single-exec/00145.c
  #if 0 != (0 && (0/0))
     #error 0 != (0 && (0/0))
  #endif
  
  #if 1 != (-1 || (0/0))
     #error 1 != (-1 || (0/0))
  #endif
  
  #if 3 != (-1 ? 3 : (0/0))
     #error 3 != (-1 ? 3 : (0/0))
  #endif
  
  int
  main()
  {
  	return 0;
  }
  +tcc ./tests/single-exec/00145.c -o ./tests/single-exec/00145.c.bin
  ./tests/single-exec/00145.c:0: error: division by zero in constant
  +exit 1
not ok ./tests/single-exec/00159.c
  #include <stdio.h>
  
  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 main()
  {
     printf("%d\n", myfunc(3));
     printf("%d\n", myfunc(4));
  
     vfunc(1234);
  
     qfunc();
  
     return 0;
  }
  
  // vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
  +tcc ./tests/single-exec/00159.c -o ./tests/single-exec/00159.c.bin
  Segmentation fault (core dumped)
  +exit 1
not ok ./tests/single-exec/00162.c
  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 main()
  {
    return 0;
  }
  +tcc ./tests/single-exec/00162.c -o ./tests/single-exec/00162.c.bin
  ./tests/single-exec/00162.c:2: error: identifier expected
  +exit 1
not ok ./tests/single-exec/00174.c
  #include <stdio.h>
  #include <math.h>
  
  int main()
  {
     // variables
     float a = 12.34 + 56.78;
     printf("%f\n", a);
  
     // infix operators
     printf("%f\n", 12.34 + 56.78);
     printf("%f\n", 12.34 - 56.78);
     printf("%f\n", 12.34 * 56.78);
     printf("%f\n", 12.34 / 56.78);
  
     // comparison operators
     printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78);
     printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34);
     printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34);
  
     // assignment operators
     a = 12.34;
     a += 56.78;
     printf("%f\n", a);
  
     a = 12.34;
     a -= 56.78;
     printf("%f\n", a);
  
     a = 12.34;
     a *= 56.78;
     printf("%f\n", a);
  
     a = 12.34;
     a /= 56.78;
     printf("%f\n", a);
  
     // prefix operators
     printf("%f\n", +12.34);
     printf("%f\n", -12.34);
  
     // type coercion
     a = 2;
     printf("%f\n", a);
     printf("%f\n", sin(2));
  
     return 0;
  }
  
  /* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
  +tcc ./tests/single-exec/00174.c -o ./tests/single-exec/00174.c.bin
  tcc: error: undefined symbol 'sin'
  +exit 1
not ok ./tests/single-exec/00204.c
  // This program is designed to test some arm64-specific things, such as the
  // calling convention, but should give the same results on any architecture.
  
  #include <stdarg.h>
  #include <stdint.h>
  #include <stdio.h>
  
  struct s1 { char x[1]; } s1 = { "0" };
  struct s2 { char x[2]; } s2 = { "12" };
  struct s3 { char x[3]; } s3 = { "345" };
  struct s4 { char x[4]; } s4 = { "6789" };
  struct s5 { char x[5]; } s5 = { "abcde" };
  struct s6 { char x[6]; } s6 = { "fghijk" };
  struct s7 { char x[7]; } s7 = { "lmnopqr" };
  struct s8 { char x[8]; } s8 = { "stuvwxyz" };
  struct s9 { char x[9]; } s9 = { "ABCDEFGHI" };
  struct s10 { char x[10]; } s10 = { "JKLMNOPQRS" };
  struct s11 { char x[11]; } s11 = { "TUVWXYZ0123" };
  struct s12 { char x[12]; } s12 = { "456789abcdef" };
  struct s13 { char x[13]; } s13 = { "ghijklmnopqrs" };
  struct s14 { char x[14]; } s14 = { "tuvwxyzABCDEFG" };
  struct s15 { char x[15]; } s15 = { "HIJKLMNOPQRSTUV" };
  struct s16 { char x[16]; } s16 = { "WXYZ0123456789ab" };
  struct s17 { char x[17]; } s17 = { "cdefghijklmnopqrs" };
  
  struct hfa11 { float a; } hfa11 = { 11.1 };
  struct hfa12 { float a, b; } hfa12 = { 12.1, 12.2 };
  struct hfa13 { float a, b, c; } hfa13 = { 13.1, 13.2, 13.3 };
  struct hfa14 { float a, b, c, d; } hfa14 = { 14.1, 14.2, 14.3, 14.4 };
  
  struct hfa21 { double a; } hfa21 = { 21.1 };
  struct hfa22 { double a, b; } hfa22 = { 22.1, 22.2 };
  struct hfa23 { double a, b, c; } hfa23 = { 23.1, 23.2, 23.3 };
  struct hfa24 { double a, b, c, d; } hfa24 = { 24.1, 24.2, 24.3, 24.4 };
  
  struct hfa31 { long double a; } hfa31 = { 31.1 };
  struct hfa32 { long double a, b; } hfa32 = { 32.1, 32.2 };
  struct hfa33 { long double a, b, c; } hfa33 = { 33.1, 33.2, 33.3 };
  struct hfa34 { long double a, b, c, d; } hfa34 = { 34.1, 34.2, 34.3, 34.4 };
  
  void fa_s1(struct s1 a) { printf("%.1s\n", a.x); }
  void fa_s2(struct s2 a) { printf("%.2s\n", a.x); }
  void fa_s3(struct s3 a) { printf("%.3s\n", a.x); }
  void fa_s4(struct s4 a) { printf("%.4s\n", a.x); }
  void fa_s5(struct s5 a) { printf("%.5s\n", a.x); }
  void fa_s6(struct s6 a) { printf("%.6s\n", a.x); }
  void fa_s7(struct s7 a) { printf("%.7s\n", a.x); }
  void fa_s8(struct s8 a) { printf("%.8s\n", a.x); }
  void fa_s9(struct s9 a) { printf("%.9s\n", a.x); }
  void fa_s10(struct s10 a) { printf("%.10s\n", a.x); }
  void fa_s11(struct s11 a) { printf("%.11s\n", a.x); }
  void fa_s12(struct s12 a) { printf("%.12s\n", a.x); }
  void fa_s13(struct s13 a) { printf("%.13s\n", a.x); }
  void fa_s14(struct s14 a) { printf("%.14s\n", a.x); }
  void fa_s15(struct s15 a) { printf("%.15s\n", a.x); }
  void fa_s16(struct s16 a) { printf("%.16s\n", a.x); }
  void fa_s17(struct s17 a) { printf("%.17s\n", a.x); }
  
  void fa_hfa11(struct hfa11 a)
  { printf("%.1f\n", a.a); }
  void fa_hfa12(struct hfa12 a)
  { printf("%.1f %.1f\n", a.a, a.a); }
  void fa_hfa13(struct hfa13 a)
  { printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
  void fa_hfa14(struct hfa14 a)
  { printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
  
  void fa_hfa21(struct hfa21 a)
  { printf("%.1f\n", a.a); }
  void fa_hfa22(struct hfa22 a)
  { printf("%.1f %.1f\n", a.a, a.a); }
  void fa_hfa23(struct hfa23 a)
  { printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
  void fa_hfa24(struct hfa24 a)
  { printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
  
  void fa_hfa31(struct hfa31 a)
  { printf("%.1Lf\n", a.a); }
  void fa_hfa32(struct hfa32 a)
  { printf("%.1Lf %.1Lf\n", a.a, a.a); }
  void fa_hfa33(struct hfa33 a)
  { printf("%.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c); }
  void fa_hfa34(struct hfa34 a)
  { printf("%.1Lf %.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c, a.d); }
  
  void fa1(struct s8 a, struct s9 b, struct s10 c, struct s11 d,
           struct s12 e, struct s13 f)
  {
      printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
  }
  
  void fa2(struct s9 a, struct s10 b, struct s11 c, struct s12 d,
           struct s13 e, struct s14 f)
  {
      printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
  }
  
  void fa3(struct hfa14 a, struct hfa23 b, struct hfa32 c)
  {
      printf("%.1f %.1f %.1f %.1f %.1Lf %.1Lf\n",
             a.a, a.d, b.a, b.c, c.a, c.b);
  }
  
  void fa4(struct s1 a, struct hfa14 b, struct s2 c, struct hfa24 d,
           struct s3 e, struct hfa34 f)
  {
      printf("%.1s %.1f %.1f %.2s %.1f %.1f %.3s %.1Lf %.1Lf\n",
             a.x, b.a, b.d, c.x, d.a, d.d, e.x, f.a, f.d);
  }
  
  void arg(void)
  {
      printf("Arguments:\n");
      fa_s1(s1);
      fa_s2(s2);
      fa_s3(s3);
      fa_s4(s4);
      fa_s5(s5);
      fa_s6(s6);
      fa_s7(s7);
      fa_s8(s8);
      fa_s9(s9);
      fa_s10(s10);
      fa_s11(s11);
      fa_s12(s12);
      fa_s13(s13);
      fa_s14(s14);
      fa_s15(s15);
      fa_s16(s16);
      fa_s17(s17);
      fa_hfa11(hfa11);
      fa_hfa12(hfa12);
      fa_hfa13(hfa13);
      fa_hfa14(hfa14);
      fa_hfa21(hfa21);
      fa_hfa22(hfa22);
      fa_hfa23(hfa23);
      fa_hfa24(hfa24);
      fa_hfa31(hfa31);
      fa_hfa32(hfa32);
      fa_hfa33(hfa33);
      fa_hfa34(hfa34);
      fa1(s8, s9, s10, s11, s12, s13);
      fa2(s9, s10, s11, s12, s13, s14);
      fa3(hfa14, hfa23, hfa32);
      fa4(s1, hfa14, s2, hfa24, s3, hfa34);
  }
  
  struct s1 fr_s1(void) { return s1; }
  struct s2 fr_s2(void) { return s2; }
  struct s3 fr_s3(void) { return s3; }
  struct s4 fr_s4(void) { return s4; }
  struct s5 fr_s5(void) { return s5; }
  struct s6 fr_s6(void) { return s6; }
  struct s7 fr_s7(void) { return s7; }
  struct s8 fr_s8(void) { return s8; }
  struct s9 fr_s9(void) { return s9; }
  struct s10 fr_s10(void) { return s10; }
  struct s11 fr_s11(void) { return s11; }
  struct s12 fr_s12(void) { return s12; }
  struct s13 fr_s13(void) { return s13; }
  struct s14 fr_s14(void) { return s14; }
  struct s15 fr_s15(void) { return s15; }
  struct s16 fr_s16(void) { return s16; }
  struct s17 fr_s17(void) { return s17; }
  
  struct hfa11 fr_hfa11(void) { return hfa11; }
  struct hfa12 fr_hfa12(void) { return hfa12; }
  struct hfa13 fr_hfa13(void) { return hfa13; }
  struct hfa14 fr_hfa14(void) { return hfa14; }
  
  struct hfa21 fr_hfa21(void) { return hfa21; }
  struct hfa22 fr_hfa22(void) { return hfa22; }
  struct hfa23 fr_hfa23(void) { return hfa23; }
  struct hfa24 fr_hfa24(void) { return hfa24; }
  
  struct hfa31 fr_hfa31(void) { return hfa31; }
  struct hfa32 fr_hfa32(void) { return hfa32; }
  struct hfa33 fr_hfa33(void) { return hfa33; }
  struct hfa34 fr_hfa34(void) { return hfa34; }
  
  void ret(void)
  {
      struct s1 t1 = fr_s1();
      struct s2 t2 = fr_s2();
      struct s3 t3 = fr_s3();
      struct s4 t4 = fr_s4();
      struct s5 t5 = fr_s5();
      struct s6 t6 = fr_s6();
      struct s7 t7 = fr_s7();
      struct s8 t8 = fr_s8();
      struct s9 t9 = fr_s9();
      struct s10 t10 = fr_s10();
      struct s11 t11 = fr_s11();
      struct s12 t12 = fr_s12();
      struct s13 t13 = fr_s13();
      struct s14 t14 = fr_s14();
      struct s15 t15 = fr_s15();
      struct s16 t16 = fr_s16();
      struct s17 t17 = fr_s17();
      printf("Return values:\n");
      printf("%.1s\n", t1.x);
      printf("%.2s\n", t2.x);
      printf("%.3s\n", t3.x);
      printf("%.4s\n", t4.x);
      printf("%.5s\n", t5.x);
      printf("%.6s\n", t6.x);
      printf("%.7s\n", t7.x);
      printf("%.8s\n", t8.x);
      printf("%.9s\n", t9.x);
      printf("%.10s\n", t10.x);
      printf("%.11s\n", t11.x);
      printf("%.12s\n", t12.x);
      printf("%.13s\n", t13.x);
      printf("%.14s\n", t14.x);
      printf("%.15s\n", t15.x);
      printf("%.16s\n", t16.x);
      printf("%.17s\n", t17.x);
      printf("%.1f\n", fr_hfa11().a);
      printf("%.1f %.1f\n", fr_hfa12().a, fr_hfa12().b);
      printf("%.1f %.1f\n", fr_hfa13().a, fr_hfa13().c);
      printf("%.1f %.1f\n", fr_hfa14().a, fr_hfa14().d);
      printf("%.1f\n", fr_hfa21().a);
      printf("%.1f %.1f\n", fr_hfa22().a, fr_hfa22().b);
      printf("%.1f %.1f\n", fr_hfa23().a, fr_hfa23().c);
      printf("%.1f %.1f\n", fr_hfa24().a, fr_hfa24().d);
      printf("%.1Lf\n", fr_hfa31().a);
      printf("%.1Lf %.1Lf\n", fr_hfa32().a, fr_hfa32().b);
      printf("%.1Lf %.1Lf\n", fr_hfa33().a, fr_hfa33().c);
      printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
  }
  
  int match(const char **s, const char *f)
  {
      const char *p = *s;
      for (p = *s; *f && *f == *p; f++, p++)
          ;
      if (!*f) {
          *s = p - 1;
          return 1;
      }
      return 0;
  }
  
  void myprintf(const char *format, ...)
  {
      const char *s;
      va_list ap;
      va_start(ap, format);
      for (s = format; *s; s++) {
          if (match(&s, "%7s")) {
              struct s7 t7 = va_arg(ap, struct s7);
              printf("%.7s", t7.x);
          }
          else if (match(&s, "%9s")) {
              struct s9 t9 = va_arg(ap, struct s9);
              printf("%.9s", t9.x);
          }
          else if (match(&s, "%hfa11")) {
              struct hfa11 x = va_arg(ap, struct hfa11);
              printf("%.1f,%.1f", x.a, x.a);
          }
          else if (match(&s, "%hfa12")) {
              struct hfa12 x = va_arg(ap, struct hfa12);
              printf("%.1f,%.1f", x.a, x.b);
          }
          else if (match(&s, "%hfa13")) {
              struct hfa13 x = va_arg(ap, struct hfa13);
              printf("%.1f,%.1f", x.a, x.c);
          }
          else if (match(&s, "%hfa14")) {
              struct hfa14 x = va_arg(ap, struct hfa14);
              printf("%.1f,%.1f", x.a, x.d);
          }
          else if (match(&s, "%hfa21")) {
              struct hfa21 x = va_arg(ap, struct hfa21);
              printf("%.1f,%.1f", x.a, x.a);
          }
          else if (match(&s, "%hfa22")) {
              struct hfa22 x = va_arg(ap, struct hfa22);
              printf("%.1f,%.1f", x.a, x.b);
          }
          else if (match(&s, "%hfa23")) {
              struct hfa23 x = va_arg(ap, struct hfa23);
              printf("%.1f,%.1f", x.a, x.c);
          }
          else if (match(&s, "%hfa24")) {
              struct hfa24 x = va_arg(ap, struct hfa24);
              printf("%.1f,%.1f", x.a, x.d);
          }
          else if (match(&s, "%hfa31")) {
              struct hfa31 x = va_arg(ap, struct hfa31);
              printf("%.1Lf,%.1Lf", x.a, x.a);
          }
          else if (match(&s, "%hfa32")) {
              struct hfa32 x = va_arg(ap, struct hfa32);
              printf("%.1Lf,%.1Lf", x.a, x.b);
          }
          else if (match(&s, "%hfa33")) {
              struct hfa33 x = va_arg(ap, struct hfa33);
              printf("%.1Lf,%.1Lf", x.a, x.c);
          }
          else if (match(&s, "%hfa34")) {
              struct hfa34 x = va_arg(ap, struct hfa34);
              printf("%.1Lf,%.1Lf", x.a, x.d);
          }
          else
              putchar(*s);
      }
      putchar('\n');
  }
  
  void stdarg(void)
  {
      printf("stdarg:\n");
      myprintf("%9s %9s %9s %9s %9s %9s", s9, s9, s9, s9, s9, s9);
      myprintf("%7s %9s %9s %9s %9s %9s", s7, s9, s9, s9, s9, s9);
  
      myprintf("HFA long double:");
      myprintf("%hfa34 %hfa34 %hfa34 %hfa34", hfa34, hfa34, hfa34, hfa34);
      myprintf("%hfa33 %hfa34 %hfa34 %hfa34", hfa33, hfa34, hfa34, hfa34);
      myprintf("%hfa32 %hfa34 %hfa34 %hfa34", hfa32, hfa34, hfa34, hfa34);
      myprintf("%hfa31 %hfa34 %hfa34 %hfa34", hfa31, hfa34, hfa34, hfa34);
  
      myprintf("%hfa32 %hfa33 %hfa33 %hfa33 %hfa33",
               hfa32, hfa33, hfa33, hfa33, hfa33);
      myprintf("%hfa31 %hfa33 %hfa33 %hfa33 %hfa33",
               hfa31, hfa33, hfa33, hfa33, hfa33);
      myprintf("%hfa33 %hfa33 %hfa33 %hfa33",
               hfa33, hfa33, hfa33, hfa33);
  
      myprintf("%hfa34 %hfa32 %hfa32 %hfa32 %hfa32",
               hfa34, hfa32, hfa32, hfa32, hfa32);
      myprintf("%hfa33 %hfa32 %hfa32 %hfa32 %hfa32",
               hfa33, hfa32, hfa32, hfa32, hfa32);
  
      myprintf("%hfa34 %hfa32 %hfa31 %hfa31 %hfa31 %hfa31",
               hfa34, hfa32, hfa31, hfa31, hfa31, hfa31);
  
      myprintf("HFA double:");
      myprintf("%hfa24 %hfa24 %hfa24 %hfa24", hfa24, hfa24, hfa24, hfa24);
      myprintf("%hfa23 %hfa24 %hfa24 %hfa24", hfa23, hfa24, hfa24, hfa24);
      myprintf("%hfa22 %hfa24 %hfa24 %hfa24", hfa22, hfa24, hfa24, hfa24);
      myprintf("%hfa21 %hfa24 %hfa24 %hfa24", hfa21, hfa24, hfa24, hfa24);
  
      myprintf("%hfa22 %hfa23 %hfa23 %hfa23 %hfa23",
               hfa22, hfa23, hfa23, hfa23, hfa23);
      myprintf("%hfa21 %hfa23 %hfa23 %hfa23 %hfa23",
               hfa21, hfa23, hfa23, hfa23, hfa23);
      myprintf("%hfa23 %hfa23 %hfa23 %hfa23",
               hfa23, hfa23, hfa23, hfa23);
  
      myprintf("%hfa24 %hfa22 %hfa22 %hfa22 %hfa22",
               hfa24, hfa22, hfa22, hfa22, hfa22);
      myprintf("%hfa23 %hfa22 %hfa22 %hfa22 %hfa22",
               hfa23, hfa22, hfa22, hfa22, hfa22);
  
      myprintf("%hfa24 %hfa22 %hfa21 %hfa21 %hfa21 %hfa21",
               hfa24, hfa22, hfa21, hfa21, hfa21, hfa21);
  
      myprintf("HFA float:");
      myprintf("%hfa14 %hfa14 %hfa14 %hfa14", hfa14, hfa14, hfa14, hfa14);
      myprintf("%hfa13 %hfa14 %hfa14 %hfa14", hfa13, hfa14, hfa14, hfa14);
      myprintf("%hfa12 %hfa14 %hfa14 %hfa14", hfa12, hfa14, hfa14, hfa14);
      myprintf("%hfa11 %hfa14 %hfa14 %hfa14", hfa11, hfa14, hfa14, hfa14);
  
      myprintf("%hfa12 %hfa13 %hfa13 %hfa13 %hfa13",
               hfa12, hfa13, hfa13, hfa13, hfa13);
      myprintf("%hfa11 %hfa13 %hfa13 %hfa13 %hfa13",
               hfa11, hfa13, hfa13, hfa13, hfa13);
      myprintf("%hfa13 %hfa13 %hfa13 %hfa13",
               hfa13, hfa13, hfa13, hfa13);
  
      myprintf("%hfa14 %hfa12 %hfa12 %hfa12 %hfa12",
               hfa14, hfa12, hfa12, hfa12, hfa12);
      myprintf("%hfa13 %hfa12 %hfa12 %hfa12 %hfa12",
               hfa13, hfa12, hfa12, hfa12, hfa12);
  
      myprintf("%hfa14 %hfa12 %hfa11 %hfa11 %hfa11 %hfa11",
               hfa14, hfa12, hfa11, hfa11, hfa11, hfa11);
  }
  
  void pll(unsigned long long x)
  {
      printf("%llx\n", x);
  }
  
  void movi(void)
  {
      printf("MOVI:\n");
      pll(0);
      pll(0xabcd);
      pll(0xabcd0000);
      pll(0xabcd00000000);
      pll(0xabcd000000000000);
      pll(0xffffabcd);
      pll(0xabcdffff);
      pll(0xffffffffffffabcd);
      pll(0xffffffffabcdffff);
      pll(0xffffabcdffffffff);
      pll(0xabcdffffffffffff);
      pll(0xaaaaaaaa);
      pll(0x5555555555555555);
      pll(0x77777777);
      pll(0x3333333333333333);
      pll(0xf8f8f8f8);
      pll(0x1e1e1e1e1e1e1e1e);
      pll(0x3f803f80);
      pll(0x01ff01ff01ff01ff);
      pll(0x007fffc0);
      pll(0x03fff80003fff800);
      pll(0x0007fffffffffe00);
  
      pll(0xabcd1234);
      pll(0xabcd00001234);
      pll(0xabcd000000001234);
      pll(0xabcd12340000);
      pll(0xabcd000012340000);
      pll(0xabcd123400000000);
      pll(0xffffffffabcd1234);
      pll(0xffffabcdffff1234);
      pll(0xabcdffffffff1234);
      pll(0xffffabcd1234ffff);
      pll(0xabcdffff1234ffff);
      pll(0xabcd1234ffffffff);
  
      pll(0xffffef0123456789);
      pll(0xabcdef012345ffff);
  
      pll(0xabcdef0123456789);
  }
  
  static uint32_t addip0(uint32_t x) { return x + 0; }
  static uint64_t sublp0(uint64_t x) { return x - 0; }
  static uint32_t addip123(uint32_t x) { return x + 123; }
  static uint64_t addlm123(uint64_t x) { return x + -123; }
  static uint64_t sublp4095(uint64_t x) { return x - 4095; }
  static uint32_t subim503808(uint32_t x) { return x - -503808; }
  static uint64_t addp12345(uint64_t x) { return x + 12345; }
  static uint32_t subp12345(uint32_t x) { return x - 12345; }
  
  static uint32_t mvni(uint32_t x) { return 0xffffffff - x; }
  static uint64_t negl(uint64_t x) { return 0 - x; }
  static uint32_t rsbi123(uint32_t x) { return 123 - x; }
  static uint64_t rsbl123(uint64_t x) { return 123 - x; }
  
  static uint32_t andi0(uint32_t x) { return x & 0; }
  static uint64_t andlm1(uint64_t x) { return x & -1; }
  static uint64_t orrl0(uint64_t x) { return x | 0; }
  static uint32_t orrim1(uint32_t x) { return x | -1; }
  static uint32_t eori0(uint32_t x) { return x ^ 0; }
  static uint64_t eorlm1(uint64_t x) { return x ^ -1; }
  static uint32_t and0xf0(uint32_t x) { return x & 0xf0; }
  static uint64_t orr0xf0(uint64_t x) { return x | 0xf0; }
  static uint64_t eor0xf0(uint64_t x) { return x ^ 0xf0; }
  
  static uint32_t lsli0(uint32_t x) { return x << 0; }
  static uint32_t lsri0(uint32_t x) { return x >> 0; }
  static int64_t asrl0(int64_t x) { return x >> 0; }
  static uint32_t lsli1(uint32_t x) { return x << 1; }
  static uint32_t lsli31(uint32_t x) { return x << 31; }
  static uint64_t lsll1(uint64_t x) { return x << 1; }
  static uint64_t lsll63(uint64_t x) { return x << 63; }
  static uint32_t lsri1(uint32_t x) { return x >> 1; }
  static uint32_t lsri31(uint32_t x) { return x >> 31; }
  static uint64_t lsrl1(uint64_t x) { return x >> 1; }
  static uint64_t lsrl63(uint64_t x) { return x >> 63; }
  static int32_t asri1(int32_t x) { return x >> 1; }
  static int32_t asri31(int32_t x) { return x >> 31; }
  static int64_t asrl1(int64_t x) { return x >> 1; }
  static int64_t asrl63(int64_t x) { return x >> 63; }
  
  void opi(void)
  {
      int x = 1000;
      pll(addip0(x));
      pll(sublp0(x));
      pll(addip123(x));
      pll(addlm123(x));
      pll(sublp4095(x));
      pll(subim503808(x));
      pll(addp12345(x));
      pll(subp12345(x));
      pll(mvni(x));
      pll(negl(x));
      pll(rsbi123(x));
      pll(rsbl123(x));
      pll(andi0(x));
      pll(andlm1(x));
      pll(orrl0(x));
      pll(orrim1(x));
      pll(eori0(x));
      pll(eorlm1(x));
      pll(and0xf0(x));
      pll(orr0xf0(x));
      pll(eor0xf0(x));
      pll(lsli0(x));
      pll(lsri0(x));
      pll(asrl0(x));
      pll(lsli1(x));
      pll(lsli31(x));
      pll(lsll1(x));
      pll(lsll63(x));
      pll(lsri1(x));
      pll(lsri31(x));
      pll(lsrl1(x));
      pll(lsrl63(x));
      pll(asri1(x));
      pll(asri31(x));
      pll(asrl1(x));
      pll(asrl63(x));
  }
  
  void pcs(void)
  {
      arg();
      ret();
      stdarg();
      movi();
      opi();
  }
  
  int main()
  {
      pcs();
      return 0;
  }
  +tcc ./tests/single-exec/00204.c -o ./tests/single-exec/00204.c.bin
  +./tests/single-exec/00204.c.bin
  +diff -u ./tests/single-exec/00204.c.expected ./tests/single-exec/00204.c.output
  --- ./tests/single-exec/00204.c.expected	2019-05-15 05:26:54.092515088 +0000
  +++ ./tests/single-exec/00204.c.output	2019-05-15 05:45:43.142876043 +0000
  @@ -79,25 +79,25 @@
   HFA double:
   24.1,24.4 24.1,24.4 24.1,24.4 24.1,24.4
   23.1,23.3 24.1,24.4 24.1,24.4 24.1,24.4
  -22.1,22.2 24.1,24.4 24.1,24.4 24.1,24.4
  +22.1,0.0 24.1,24.4 24.1,24.4 24.1,24.4
   21.1,21.1 24.1,24.4 24.1,24.4 24.1,24.4
  -22.1,22.2 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
  +22.1,0.0 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
   21.1,21.1 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
   23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
  -24.1,24.4 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
  -23.1,23.3 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
  -24.1,24.4 22.1,22.2 21.1,21.1 21.1,21.1 21.1,21.1 21.1,21.1
  +24.1,24.4 22.1,0.0 22.2,0.0 22.1,0.0 22.2,0.0
  +23.1,23.3 22.1,0.0 22.2,0.0 22.1,0.0 22.2,0.0
  +24.1,24.4 22.1,0.0 22.2,22.2 21.1,21.1 21.1,21.1 21.1,21.1
   HFA float:
  -14.1,14.4 14.1,14.4 14.1,14.4 14.1,14.4
  -13.1,13.3 14.1,14.4 14.1,14.4 14.1,14.4
  -12.1,12.2 14.1,14.4 14.1,14.4 14.1,14.4
  -11.1,11.1 14.1,14.4 14.1,14.4 14.1,14.4
  -12.1,12.2 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
  -11.1,11.1 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
  -13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
  -14.1,14.4 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
  -13.1,13.3 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
  -14.1,14.4 12.1,12.2 11.1,11.1 11.1,11.1 11.1,11.1 11.1,11.1
  +14.1,0.0 14.3,0.0 14.1,0.0 14.3,0.0
  +13.1,0.0 13.3,0.0 14.1,0.0 14.3,0.0
  +12.1,12.2 14.1,0.0 14.1,0.0 14.1,0.0
  +11.1,11.1 14.1,0.0 14.1,0.0 14.1,0.0
  +12.1,12.2 13.1,0.0 13.1,0.0 13.1,0.0 13.3,0.0
  +11.1,11.1 13.1,0.0 13.1,0.0 13.1,0.0 13.3,0.0
  +13.1,0.0 13.3,0.0 13.1,0.0 13.3,0.0
  +14.1,0.0 14.3,14.4 12.1,12.2 12.1,12.2 12.1,12.2
  +13.1,0.0 13.3,14.1 12.1,12.2 12.1,12.2 12.1,12.2
  +14.1,0.0 14.3,14.4 12.1,12.1 11.1,11.1 11.1,11.1 11.1,11.1
   MOVI:
   0
   abcd
  +exit 1
not ok ./tests/single-exec/00206.c
  #include <stdio.h>
  
  int main()
  {
      /* must not affect how #pragma ppop_macro works */
      #define pop_macro foobar1
  
      /* must not affect how #pragma push_macro works */
      #define push_macro foobar2
  
      #undef abort
      #define abort "111"
      printf("abort = %s\n", abort);
  
      #pragma push_macro("abort")
      #undef abort
      #define abort "222"
      printf("abort = %s\n", abort);
  
      #pragma push_macro("abort")
      #undef abort
      #define abort "333"
      printf("abort = %s\n", abort);
  
      #pragma pop_macro("abort")
      printf("abort = %s\n", abort);
  
      #pragma pop_macro("abort")
      printf("abort = %s\n", abort);
  }
  +tcc ./tests/single-exec/00206.c -o ./tests/single-exec/00206.c.bin
  +./tests/single-exec/00206.c.bin
  +exit 1
not ok ./tests/single-exec/00210.c
  typedef unsigned short uint16_t;
  typedef unsigned char uint8_t;
  
  typedef union Unaligned16a {
    uint16_t u;
    uint8_t b[2];
  } __attribute__((packed)) Unaligned16a;
  
  typedef union __attribute__((packed)) Unaligned16b {
    uint16_t u;
    uint8_t b[2];
  } Unaligned16b;
  
  extern void foo (void) __attribute__((stdcall));
  void __attribute__((stdcall)) foo (void)
  {
  }
  
  /* The actual attribute isn't important, must just be
     parsable.  */
  #define ATTR __attribute__((__noinline__))
  int ATTR actual_function() {
    return 42;
  }
  
  extern int printf (const char *, ...);
  int main()
  {
      void *function_pointer = &actual_function;
  
      int a = ((ATTR int(*) (void)) function_pointer)();
      printf("%i\n", a);
  
      /* In the following we once misparsed 'ATTR *' is a btype
         and hence the whole type was garbled.  */
      int b = ( (int(ATTR *)(void))  function_pointer)();
      printf("%i\n", b);
  
      return 0;
  }
  +tcc ./tests/single-exec/00210.c -o ./tests/single-exec/00210.c.bin
  ./tests/single-exec/00210.c:36: warning: assignment makes integer from pointer without a cast
  +./tests/single-exec/00210.c.bin
  +exit 1
not ok ./tests/single-exec/00211.c
  extern int printf(const char *format, ...);
  
  #define ACPI_TYPE_INVALID       0x1E
  #define NUM_NS_TYPES            ACPI_TYPE_INVALID+1
  int array[NUM_NS_TYPES];
  
  #define n 0xe
  int main()
  {
      printf("n+1 = %d\n", n+1);
  //    printf("n+1 = %d\n", 0xe+1);
  }
  +tcc ./tests/single-exec/00211.c -o ./tests/single-exec/00211.c.bin
  +./tests/single-exec/00211.c.bin
  +exit 1
not ok ./tests/single-exec/00212.c
  #include <stdio.h>
  
  int
  main()
  {
  #if defined(__LLP64__)
  	if (sizeof(short) == 2
  	    && sizeof(int) == 4
  	    && sizeof(long int) == 4
  	    && sizeof(long long int) == 8
  	    && sizeof(void*) == 8) {
  		(void)printf("Ok\n");
  	} else {
  		(void)printf("KO __LLP64__\n");
  	}
  #elif defined(__LP64__)
  	if (sizeof(short) == 2
  	    && sizeof(int) == 4
  	    && sizeof(long int) == 8
  	    && sizeof(long long int) == 8
  	    && sizeof(void*) == 8) {
  		(void)printf("Ok\n");
  	} else {
  		(void)printf("KO __LP64__\n");
  	}
  #elif defined(__ILP32__)
  	if (sizeof(short) == 2
  	    && sizeof(int) == 4
  	    && sizeof(long int) == 4
  	    && sizeof(void*) == 4) {
  		(void)printf("Ok\n");
  	} else {
  		(void)printf("KO __ILP32__\n");
  	}
  #else
  	(void)printf("KO no __*LP*__ defined.\n");
  #endif
  }
  +tcc ./tests/single-exec/00212.c -o ./tests/single-exec/00212.c.bin
  +./tests/single-exec/00212.c.bin
  +exit 1
not ok ./tests/single-exec/00213.c
  /* This checks various ways of dead code inside if statements
     where there are non-obvious ways of how the code is actually
     not dead due to reachable by labels.  */
  extern int printf (const char *, ...);
  static void kb_wait_1(void)
  {
    unsigned long timeout = 2;
    do {
        /* Here the else arm is a statement expression that's supposed
           to be suppressed.  The label inside the while would unsuppress
  	 code generation again if not handled correctly.  And that
  	 would wreak havoc to the cond-expression because there's no
  	 jump-around emitted, the whole statement expression really
  	 needs to not generate code (perhaps except useless forward jumps).  */
        (1 ? 
         printf("timeout=%ld\n", timeout) :
         ({
  	int i = 1;
  	while (1)
  	  while (i--)
  	    some_label:
  	      printf("error\n");
  	goto some_label;
  	})
        );
        timeout--;
    } while (timeout);
  }
  
  static int global;
  
  static void foo(int i)
  {
    global+=i;
    printf ("g=%d\n", global);
  }
  
  static int check(void)
  {
    printf ("check %d\n", global);
    return 1;
  }
  
  static void dowhile(void)
  {
    do {
        foo(1);
        if (global == 1) {
  	  continue;
        } else if (global == 2) {
  	  continue;
        }
        /* The following break shouldn't disable the check() call,
           as it's reachable by the continues above.  */
        break;
    } while (check());
  }
  
  int main (void)
  {
    int i = 1;
    kb_wait_1();
  
    /* Simple test of dead code at first sight which isn't actually dead. */
    if (0) {
  yeah:
        printf ("yeah\n");
    } else {
        printf ("boo\n");
    }
    if (i--)
      goto yeah;
  
    /* Some more non-obvious uses where the problems are loops, so that even
       the first loop statements aren't actually dead.  */
    i = 1;
    if (0) {
        while (i--) {
  	  printf ("once\n");
  enterloop:
  	  printf ("twice\n");
        }
    }
    if (i >= 0)
      goto enterloop;
  
    /* The same with statement expressions.  One might be tempted to
       handle them specially by counting if inside statement exprs and
       not unsuppressing code at loops at all then.
       See kb_wait_1 for the other side of the medal where that wouldn't work.  */
    i = ({
        int j = 1;
        if (0) {
  	  while (j--) {
  	      printf ("SEonce\n");
      enterexprloop:
  	      printf ("SEtwice\n");
  	  }
        }
        if (j >= 0)
  	goto enterexprloop;
        j; });
  
    /* The other two loop forms: */
    i = 1;
    if (0) {
        for (i = 1; i--;) {
  	  printf ("once2\n");
  enterloop2:
  	  printf ("twice2\n");
        }
    }
    if (i > 0)
      goto enterloop2;
  
    i = 1;
    if (0) {
        do {
  	  printf ("once3\n");
  enterloop3:
  	  printf ("twice3\n");
        } while (i--);
    }
    if (i > 0)
      goto enterloop3;
  
    /* And check that case and default labels have the same effect
       of disabling code suppression.  */
    i = 41;
    switch (i) {
        if (0) {
  	  printf ("error\n");
        case 42:
  	  printf ("error2\n");
        case 41:
  	  printf ("caseok\n");
        }
    }
  
    i = 41;
    switch (i) {
        if (0) {
  	  printf ("error3\n");
        default:
  	  printf ("caseok2\n");
  	  break;
        case 42:
  	  printf ("error4\n");
        }
    }
  
    dowhile();
  
    return 0;
  }
  +tcc ./tests/single-exec/00213.c -o ./tests/single-exec/00213.c.bin
  +./tests/single-exec/00213.c.bin
  +diff -u ./tests/single-exec/00213.c.expected ./tests/single-exec/00213.c.output
  --- ./tests/single-exec/00213.c.expected	2019-05-15 05:26:54.092515088 +0000
  +++ ./tests/single-exec/00213.c.output	2019-05-15 05:45:44.010947590 +0000
  @@ -17,7 +17,3 @@
   caseok
   caseok2
   g=1
  -check 1
  -g=2
  -check 2
  -g=3
  +exit 1
not ok ./tests/single-exec/00219.c
  #include <stdio.h>
  
  const int a = 0;
  
  struct a {
  	int a;
  };
  
  struct b {
  	int a;
  };
  
  int a_f()
  {
  	return 20;
  }
  
  int b_f()
  {
  	return 10;
  }
  
  typedef int (*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;
  }
  +tcc ./tests/single-exec/00219.c -o ./tests/single-exec/00219.c.bin
  ./tests/single-exec/00219.c:69: error: type 'int(int)' does not match any association
  +exit 1

raw TAP data (.txt)