modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/compile/20020706-2.c (about)

     1  // Contributed by Alexandre Oliva <aoliva@redhat.com>
     2  // From Red Hat case 106165.
     3  
     4  typedef unsigned short (FUNC_P) (void *, unsigned char *, unsigned short);
     5  
     6  void crashIt(int id, FUNC_P *func, unsigned char *funcparm)
     7  {
     8    unsigned char buff[5], reverse[4];
     9    unsigned char *bp = buff;
    10    unsigned char *rp = reverse;
    11    unsigned short int count = 0;
    12    unsigned short cnt;
    13    while (id > 0)
    14      {
    15        *rp++ = (unsigned char) (id & 0x7F);
    16        id >>= 7;
    17        count++;
    18      }
    19    cnt = count + 1;
    20    while ((count--) > 1)
    21      {
    22        *bp++ = (unsigned char)(*(--rp) | 0x80);
    23      }
    24    *bp++ = *(--rp);
    25    (void)(*func)(funcparm, buff, cnt);
    26  }