aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Waddress-2.c
blob: 025efda12cb9ab312b16a3e0489dec0070331658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR c/47931 - missing -Waddress warning for comparison with NULL
  { dg-do compile }
  { dg-options "-Waddress" } */

#define NULL ((void *) 0)

int i;

int f0 (void)
{
  return &i != 0;   /* { dg-warning "the address of .i. will never be NULL" } */
}

int f1 (void)
{
  return &i != (void *) 0;   /* { dg-warning "the address of .i. will never be NULL" } */
}

int f2 (void)
{
  return &i != NULL;   /* { dg-warning "the address of .i. will never be NULL" } */
}