PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / other / pr42645-1.C
blobdf93645721e3addfe5c23ea2f22a6a04d9a24954
1 // PR tree-optimization/42645
2 // { dg-do compile }
3 // { dg-options "-fcompare-debug -O1" }
5 extern void foo ();
7 struct S
9   struct T
10   {
11     int t1;
12     char t2[4];
13     T *t3;
14   } t;
15   int m1 () const { return t.t3[0].t1; }
16   char *m2 () { foo (); return 0; }
17   void m3 (int x) { char *m = m2 (); if (m1 () > 0 && x > 0); }
18   void m4 () { if (m1 () > 0) for (int i = 0; i < 4; i++) t.t2[i] = 0; }
21 void
22 f (S *a)
24   a->m3 (0);
25   a->m4 ();