aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/other/pr42645-1.C
blob: 5dc76f9efd9c1fc75af774b2f74200aa882c8ee3 (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
// PR tree-optimization/42645
// { dg-do compile }
// { dg-options "-fcompare-debug -O1" }

extern void foo ();

struct S
{
  struct T
  {
    int t1;
    char t2[4];
    T *t3;
  } t;
  int m1 () const { return t.t3[0].t1; }
  char *m2 () { foo (); }
  void m3 (int x) { char *m = m2 (); if (m1 () > 0 && x > 0); }
  void m4 () { if (m1 () > 0) for (int i = 0; i < 4; i++) t.t2[i] = 0; }
};

void
f (S *a)
{
  a->m3 (0);
  a->m4 ();
}