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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [uninit-pred-3_a.C] - Blame information for rev 696

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

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-Wuninitialized -O2" } */
3
 
4
/* Multiple initialization paths.  */
5
 
6
typedef long long int64;
7
void incr ();
8
bool is_valid (int);
9
int  get_time ();
10
 
11
class A
12
{
13
public:
14
  A ();
15
  ~A () {
16
    if (I) delete I;
17
  }
18
 
19
private:
20
  int* I;
21
};
22
 
23
bool get_url (A *);
24
bool get_url2 (A *);
25
 
26
class M {
27
 
28
 public:
29
 __attribute__ ((always_inline))
30
 bool GetC (int *c)  {
31
 
32
    A details_str;
33
    /* Intialization path 1  */
34
    if (get_url (&details_str))
35
      {
36
        *c = get_time ();
37
        return true;
38
      }
39
 
40
    /* insert dtor calls (inlined) into following return paths  */
41
    A tmp_str;
42
 
43
    /* Intializtion path 2  */
44
    if (get_url2 (&details_str))
45
      {
46
        *c = get_time ();
47
        return true;
48
      }
49
 
50
    return false;
51
  }
52
 
53
  void do_sth();
54
  void do_sth2();
55
 
56
  void P (int64 t)
57
    {
58
      int cc;
59
      if (!GetC (&cc)) /* return flag checked properly */
60
        return;
61
 
62
      if (cc <= 0)   /* { dg-bogus "uninitialized" "uninitialized variable warning" } */
63
        {
64
          this->do_sth();
65
          return;
66
        }
67
 
68
    do_sth2();
69
  }
70
};
71
 
72
M* m;
73
void test(int x)
74
{
75
  m = new M;
76
  m->P(x);
77
}

powered by: WebSVN 2.1.0

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