aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr107345.c
blob: ea1925bfa190ba5f52d0d7dcd87324c0f6306902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Ensure the analyzer treats (NULL == &e) as being false for this case,
   where the logic is sufficiently complicated to not be optimized away.  */

#include <stdio.h>

int main() {   
  int e = 10086;
  int *f = &e;
  int g = 0;
  int *h[2][1];
  h[1][0] = f;
  if (g == (h[1][0])) { /* { dg-warning "comparison between pointer and integer" "" { target c } } */
  /* { dg-error "ISO C\\+\\+ forbids comparison between pointer and integer" "" { target c++ } .-1 } */
    unsigned int *i = 0;
  }
  printf("NPD_FLAG: %d\n ", *f);
  return 0;
}