1 // PR optimization/13067 2 // Origin: <bryner@brianryner.com> 3 4 // This used to fail on the tree-ssa because of "out-of-ssa" 5 // We might have a valid variable, but not a valid value when trying to find 6 // useless statements created by out-of-ssa translation. In this case 7 // val will be set to null, then later dereferenced. Bad. 8 9 // { dg-do compile } 10 // { dg-options "-Os" } 11 12 13 14 struct Iterator 15 { 16 Iterator operator++(); 17 }; 18 19 void GetChar(char* aChar); 20 foo(char aChar)21void foo(char aChar) 22 { 23 char quote; 24 Iterator end; 25 26 while (1) { 27 if (aChar == '"') 28 GetChar(&aChar); 29 30 switch (aChar) { 31 case 'a': 32 ++end; 33 if (quote) { 34 if (quote == aChar) { 35 quote = 0; 36 } 37 } else { 38 quote = aChar; 39 } 40 } 41 } 42 } 43 44 45 46