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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [Walways-true-1.c] - Blame information for rev 706

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test -Waddress for testing an address against NULL.
2
   Origin: Ian Lance Taylor <iant@google.com>.  */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-Waddress -fshow-column" } */
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 "7:always evaluate as" "correct warning" } */
16
    foo (0);
17
  if (foo (1))
18
    ;
19
  if (&i)       /* { dg-warning "7:always evaluate as" "correct warning" } */
20
    foo (2);
21
  if (i)
22
    foo (3);
23
  if (&a)       /* { dg-warning "7:always evaluate as" "correct warning" } */
24
    foo (4);
25
  if (a)
26
    foo (5);
27
  if (&&lab)    /* { dg-warning "7:always evaluate as" "correct warning" } */
28
    foo (6);
29
  if (foo == 0)  /* { dg-warning "11:the comparison will always evaluate as 'false'" "correct warning" } */
30
    foo (7);
31
  if (foo (1) == 0)
32
    foo (8);
33
  if (&i == 0)   /* { dg-warning "10:the comparison will always evaluate as 'false'" "correct warning" } */
34
    foo (9);
35
  if (i == 0)
36
    foo (10);
37
  if (&a == 0)   /* { dg-warning "10:the comparison will always evaluate as 'false'" "correct warning" } */
38
    foo (11);
39
  if (a == 0)
40
    foo (12);
41
  if (&&lab == 0) /* { dg-warning "13:the comparison will always evaluate as 'false'" "correct warning" } */
42
    foo (13);
43
  if (0 == foo)  /* { dg-warning "9:the comparison will always evaluate as 'false'" "correct warning" } */
44
    foo (14);
45
  if (0 == foo (1))
46
    foo (15);
47
  if (0 == &i)   /* { dg-warning "9:the comparison will always evaluate as 'false'" "correct warning" } */
48
    foo (16);
49
  if (0 == i)
50
    foo (17);
51
  if (0 == &a)   /* { dg-warning "9:the comparison will always evaluate as 'false'" "correct warning" } */
52
    foo (18);
53
  if (0 == a)
54
    foo (19);
55
  if (0 == &&lab) /* { dg-warning "9:the comparison will always evaluate as 'false'" "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.