summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/cfg4.C
blob: 94522ed4171f6623bae496c5d88a028005b6f9be (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
37
38
39
40
41
42
43
44
45
// PR optimization/13067
// Origin: <bryner@brianryner.com>

// This used to fail on the tree-ssa because of "out-of-ssa"
//  We might have a valid variable, but not a valid value when trying to find
//  useless statements created by out-of-ssa translation. In this case
//  val will be set to null, then later dereferenced.  Bad.

// { dg-do compile }
// { dg-options "-Os" }



struct Iterator
{
  Iterator operator++();
};

void GetChar(char* aChar);

void foo(char aChar)
{
  char quote;
  Iterator end;

  while (1) {
    if (aChar == '"')
      GetChar(&aChar);

    switch (aChar) {
    case 'a':
      ++end;
      if (quote) {
	if (quote == aChar) {
	  quote = 0;
	}
      } else {
	quote = aChar;
      }
    }
  }
}