Turn off profile-use optimizations when profile is not available
[official-gcc.git] / gcc-4_9 / gcc / testsuite / g++.dg / tree-ssa / dom-invalid.C
blob68fc48c2c70d385d80abeda6def1ec7aea9b9c87
1 // { dg-message  "note: file" "" }
2 // PR tree-optimization/39557
3 // invalid post-dom info leads to infinite loop
4 // { dg-do run }
5 // { dg-options "-Wall -fno-exceptions -O2 -fprofile-use  -fno-rtti -fno-diagnostics-show-caret" }
7 struct C
9  virtual const char *bar () const;
12 struct D
14  D () : d1 (0) { }
15  C *d2[4];
16  int d1;
17  inline const C & baz (int i) const { return *d2[i]; }
20 struct E
22  unsigned char e1[2];
23  D e2;
24  bool foo () const { return (e1[1] & 1) != 0; }
25  virtual const char *bar () const __attribute__ ((noinline));
28 const char *
29 C::bar () const
31  return 0;
34 C c;
36 const char *
37 E::bar () const
39  const char *e = __null;
40  if (foo () && (e = c.C::bar ()))
41    return e;
42  for (int i = 0, n = e2.d1; i < n; i++)
43    if ((e = e2.baz (i).C::bar ()))
44      return e;
45  return e;
48 int
49 main ()
51  E e;
52  e.bar ();
53