aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62175.C
blob: bcdea61e1bfbef836303cf41e7388202c37614ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// { dg-do compile }
// { dg-additional-options "-ftrapv" }

struct B {
    B(int = 0);
};
int c;
int *d;
struct G {
    G();
    int numProcs_;
};
int fn1();
B fn2() {
    if (c)
      return 0;
    return B();
}

long &fn3(long &p1, long &p2) {
    if (p2 < p1)
      return p2;
    return p1;
}

void fn4(long p1) {
    long a = fn1();
    fn2();
    int b = fn3(p1, a);
    for (int i; i < b; ++i)
      d[0] = 0;
    for (; a < p1; ++a)
      d[a] = 0;
}

G::G() { fn4(numProcs_ + 1); }