1  /* PR sanitizer/80998 */
       2  /* { dg-do run } */
       3  /* { dg-options "-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -Wall" } */
       4  
       5  struct S { int a; int b; int c[64]; };
       6  __attribute__((noinline, noclone)) char *f1 (char *p) { return p + 1; }
       7  __attribute__((noinline, noclone)) char *f2 (char *p) { return p - 1; }
       8  __attribute__((noinline, noclone)) char *f3 (char *p, int i) { return p + i; }
       9  __attribute__((noinline, noclone)) char *f4 (char *p, int i) { return p - i; }
      10  __attribute__((noinline, noclone)) char *f5 (char *p, unsigned long int i) { return p + i; }
      11  __attribute__((noinline, noclone)) char *f6 (char *p, unsigned long int i) { return p - i; }
      12  __attribute__((noinline, noclone)) int *f7 (struct S *p) { return &p->a; }
      13  __attribute__((noinline, noclone)) int *f8 (struct S *p) { return &p->b; }
      14  __attribute__((noinline, noclone)) int *f9 (struct S *p) { return &p->c[64]; }
      15  __attribute__((noinline, noclone)) int *f10 (struct S *p, int i) { return &p->c[i]; }
      16  
      17  char *volatile p;
      18  struct S *volatile q;
      19  char a[64];
      20  struct S s;
      21  int *volatile r;
      22  
      23  int
      24  main ()
      25  {
      26    struct S t;
      27    p = &a[32];
      28    p = f1 (p);
      29    p = f1 (p);
      30    p = f2 (p);
      31    p = f3 (p, 1);
      32    p = f3 (p, -1);
      33    p = f3 (p, 3);
      34    p = f3 (p, -6);
      35    p = f4 (p, 1);
      36    p = f4 (p, -1);
      37    p = f4 (p, 3);
      38    p = f4 (p, -6);
      39    p = f5 (p, 1);
      40    p = f5 (p, 3);
      41    p = f6 (p, 1);
      42    p = f6 (p, 3);
      43    if (sizeof (unsigned long) >= sizeof (char *))
      44      {
      45        p = f5 (p, -1);
      46        p = f5 (p, -6);
      47        p = f6 (p, -1);
      48        p = f6 (p, -6);
      49      }
      50    q = &s;
      51    r = f7 (q);
      52    r = f8 (q);
      53    r = f9 (q);
      54    r = f10 (q, 0);
      55    r = f10 (q, 10);
      56    r = f10 (q, 64);
      57    q = &t;
      58    r = f7 (q);
      59    r = f8 (q);
      60    r = f9 (q);
      61    r = f10 (q, 0);
      62    r = f10 (q, 10);
      63    r = f10 (q, 64);
      64    return 0;
      65  }