Add a testcase for PR 84821

Message ID 20180312133139.GA19882@intel.com
State New
Headers show
Series
  • Add a testcase for PR 84821
Related show

Commit Message

H.J. Lu March 12, 2018, 1:31 p.m.
This was introduced by r258390 and fixed by r258415.

I am checking in this to add a testcase for PR 84821.

H.J.
00
	* g++.dg/pr84821.C: New test.
---
 gcc/testsuite/ChangeLog        |  4 +++
 gcc/testsuite/g++.dg/pr84821.C | 55 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/pr84821.C

-- 
2.14.3

Patch

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c7193069550..5dead01586c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@ 
+2018-03-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* g++.dg/pr84821.C: New test.
+
 2018-03-12  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* gcc.dg/pr84799.c: New test.
diff --git a/gcc/testsuite/g++.dg/pr84821.C b/gcc/testsuite/g++.dg/pr84821.C
new file mode 100644
index 00000000000..39da3671eec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr84821.C
@@ -0,0 +1,55 @@ 
+// { dg-do compile }
+// { dg-options "-O2" }
+// { dg-additional-options "-fPIC" { target fpic } }
+
+typedef struct a *b;
+struct a {
+  int c;
+  unsigned d[];
+};
+int e, f, g, i, l, m;
+struct o {
+  long *h;
+  int c;
+  unsigned j;
+  int k;
+  long aa;
+};
+inline void p(o *r) { r->c = g; }
+int *n, *ab;
+inline bool s(o *r) {
+  for (; r->aa == 0; r->aa = r->h[r->j])
+    if (r->j >= r->c)
+      return false;
+  r->aa >>= 1;
+  for (; r->aa;)
+    r++;
+  *n = r->k;
+  return true;
+}
+class t {
+public:
+  t(int);
+  operator b() { return q; }
+  b q;
+};
+bool u, v, ac;
+void fn3() {
+  long w, x;
+  o ad;
+  bool ae;
+  t af(i), ag(i);
+  for (p(&ad); s(&ad);) {
+    a *ah = af, *ai = ah, *aj = ag;
+    x = ai->d[e] >> f & 1;
+    ae = x;
+    ai = aj;
+    w = ai->d[e] >> f & 1;
+    ac = w;
+    if (v && u && w && x)
+      ab[l] = ++m;
+    u = x;
+  }
+  for (;;)
+    ;
+}