aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/asan/pr106558.c
blob: c8cefdf09ff2bdac28a8540ebea3da289c776715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do run } */
/* { dg-options "-w -fpermissive" } */
/* { dg-shouldfail "asan" } */

int a;
int *b = &a;
int **c = &b;
int d[1];
int *e = &d[1];

static void f(int *g) {
  *b = e;
  *c = e;
  *b = 2;
  *g = 2;
}

int main() {
    f(b);
    return *b;
}

/* { dg-output "AddressSanitizer: global-buffer-overflow on address" } */