1// { dg-do compile }
2// { dg-additional-options "-ftrapv" }
3
4struct B {
5    B(int = 0);
6};
7int c;
8int *d;
9struct G {
10    G();
11    int numProcs_;
12};
13int fn1();
14B fn2() {
15    if (c)
16      return 0;
17    return B();
18}
19
20long &fn3(long &p1, long &p2) {
21    if (p2 < p1)
22      return p2;
23    return p1;
24}
25
26void fn4(long p1) {
27    long a = fn1();
28    fn2();
29    int b = fn3(p1, a);
30    for (int i; i < b; ++i)
31      d[0] = 0;
32    for (; a < p1; ++a)
33      d[a] = 0;
34}
35
36G::G() { fn4(numProcs_ + 1); }
37