summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr18084-1.C
blob: bf62a7b703546688b70d4f1f2bdc54e8c6283b60 (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
// { dg-do run }
// { dg-options "-O3" }

extern "C" void abort (void);

struct X {
    bool init;
    void foo() { if (!init) init = true; }
    void bar() { foo();                  }

};

typedef unsigned long long int uint64_t;
uint64_t mask1, mask2;

uint64_t calc() {
  return mask1 & mask2;
}

int main()
{
  mask1 = 0x00000000FFFFFFFFull;
  mask2 = 0x000000000000FFFFull;
  uint64_t value = calc();

  X().bar();

  if(value != calc())
    abort ();
  return 0;
}