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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [Walways-true-2.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Make sure we don't assume that a weak symbol is always non-NULL.
2
   This is just like Walways-true-1.C, except that it uses a weak
3
   symbol.
4
   Origin: Ian Lance Taylor <iant@google.com>.  */
5
 
6
/* { dg-do compile} */
7
/* { dg-options "-Waddress" } */
8
/* { dg-require-weak "" } */
9
 
10
extern int foo (int) __attribute__ ((weak));
11
 
12
int i __attribute__ ((weak));
13
 
14
void
15
bar (int a)
16
{
17
 lab:
18
  if (foo)
19
    foo (0);
20
  if (foo (1))
21
    ;
22
  if (&i)
23
    foo (2);
24
  if (i)
25
    foo (3);
26
  if (&a)       /* { dg-warning "always evaluate as" "correct warning" } */
27
    foo (4);
28
  if (a)
29
    foo (5);
30
  if (&&lab)    /* { dg-warning "always evaluate as" "correct warning" } */
31
    foo (6);
32
  if (foo == 0)
33
    foo (7);
34
  if (foo (1) == 0)
35
    foo (8);
36
  if (&i == 0)
37
    foo (9);
38
  if (i == 0)
39
    foo (10);
40
  if (&a == 0)   /* { dg-warning "never be NULL" "correct warning" } */
41
    foo (11);
42
  if (a == 0)
43
    foo (12);
44
  if (&&lab == 0) /* { dg-warning "never be NULL" "correct warning" } */
45
    foo (13);
46
  if (0 == foo)
47
    foo (14);
48
  if (0 == foo (1))
49
    foo (15);
50
  if (0 == &i)
51
    foo (16);
52
  if (0 == i)
53
    foo (17);
54
  if (0 == &a)   /* { dg-warning "never be NULL" "correct warning" } */
55
    foo (18);
56
  if (0 == a)
57
    foo (19);
58
  if (0 == &&lab) /* { dg-warning "never be NULL" "correct warning" } */
59
    foo (20);
60
}

powered by: WebSVN 2.1.0

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