Home | History | Annotate | Download | only in tests
      1 
      2 #include <stdlib.h>
      3 
      4 int main(void)
      5 {
      6    // When I had n-u --> u, this gave a false positive... can happen because
      7    // p+up can give n if you are (un)lucky, because the result is close enough
      8    // to zero.
      9    int  u[20];
     10    int* p = malloc(sizeof(int) * 100);
     11    int* n;
     12    int* x;
     13 
     14    p[0] = 0;                           // ok
     15    n = (int*)((long)p + (long)u);      // result is n, because near zero!
     16    x = (int*)((long)n - (long)u);      // x == p
     17    x[0] = 0;                           // ok, originally caused false pos.
     18 
     19    return 0;
     20 }
     21