OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Walways-true-1.C] - Blame information for rev 783

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test -Waddress for testing an address against NULL.
2
// Origin: Ian Lance Taylor 
3
 
4
// { dg-do compile }
5
// { dg-options "-Waddress" }
6
 
7
extern int foo (int);
8
 
9
int i;
10
 
11
void
12
bar (int a)
13
{
14
 lab:
15
  if (foo)      // { dg-warning "always evaluate as" "correct warning" }
16
    foo (0);
17
  if (foo (1))
18
    ;
19
  if (&i)       // { dg-warning "always evaluate as" "correct warning" }
20
    foo (2);
21
  if (i)
22
    foo (3);
23
  if (&a)       // { dg-warning "always evaluate as" "correct warning" }
24
    foo (4);
25
  if (a)
26
    foo (5);
27
  if (&&lab)    // { dg-warning "always evaluate as" "correct warning" }
28
    foo (6);
29
  if (foo == 0) // { dg-warning "never be NULL" "correct warning" }
30
    foo (7);
31
  if (foo (1) == 0)
32
    foo (8);
33
  if (&i == 0)  // { dg-warning "never be NULL" "correct warning" }
34
    foo (9);
35
  if (i == 0)
36
    foo (10);
37
  if (&a == 0)  // { dg-warning "never be NULL" "correct warning" }
38
    foo (11);
39
  if (a == 0)
40
    foo (12);
41
  if (&&lab == 0) // { dg-warning "never be NULL" "correct warning" }
42
    foo (13);
43
  if (0 == foo) // { dg-warning "never be NULL" "correct warning" }
44
    foo (14);
45
  if (0 == foo (1))
46
    foo (15);
47
  if (0 == &i)  // { dg-warning "never be NULL" "correct warning" }
48
    foo (16);
49
  if (0 == i)
50
    foo (17);
51
  if (0 == &a)  // { dg-warning "never be NULL" "correct warning" }
52
    foo (18);
53
  if (0 == a)
54
    foo (19);
55
  if (0 == &&lab) // { dg-warning "never be NULL" "correct warning" }
56
    foo (20);
57
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.