summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr18084-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/pr18084-1.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/pr18084-1.C32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/pr18084-1.C b/gcc/testsuite/g++.dg/opt/pr18084-1.C
new file mode 100644
index 000000000..bf62a7b70
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr18084-1.C
@@ -0,0 +1,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;
+}
+