2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr62175.C
blobbcdea61e1bfbef836303cf41e7388202c37614ec
1 // { dg-do compile }
2 // { dg-additional-options "-ftrapv" }
4 struct B {
5     B(int = 0);
6 };
7 int c;
8 int *d;
9 struct G {
10     G();
11     int numProcs_;
13 int fn1();
14 B fn2() {
15     if (c)
16       return 0;
17     return B();
20 long &fn3(long &p1, long &p2) {
21     if (p2 < p1)
22       return p2;
23     return p1;
26 void 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;
36 G::G() { fn4(numProcs_ + 1); }