modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/20010224-1.c (about)

     1  extern void abort (void);
     2  
     3  typedef signed short int16_t;
     4  typedef unsigned short uint16_t;
     5  
     6  int16_t logadd (int16_t *a, int16_t *b);
     7  void ba_compute_psd (int16_t start);
     8  
     9  int16_t masktab[6] = { 1, 2, 3, 4, 5};
    10  int16_t psd[6] = { 50, 40, 30, 20, 10};
    11  int16_t bndpsd[6] = { 1, 2, 3, 4, 5};
    12  
    13  void ba_compute_psd (int16_t start)
    14  {
    15    int i,j,k;
    16    int16_t lastbin = 4;
    17  
    18    j = start; 
    19    k = masktab[start]; 
    20  
    21    bndpsd[k] = psd[j]; 
    22    j++; 
    23  
    24    for (i = j; i < lastbin; i++) { 
    25      bndpsd[k] = logadd(&bndpsd[k], &psd[j]);
    26      j++; 
    27    } 
    28  }
    29  
    30  int16_t logadd (int16_t *a, int16_t *b)
    31  {
    32    return *a + *b;
    33  }
    34  
    35  int main (void)
    36  {
    37    int i;
    38  
    39    ba_compute_psd (0);
    40  
    41    if (bndpsd[1] != 140) abort ();
    42    return 0;
    43  }
    44