aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/pr66655.C25
-rw-r--r--gcc/testsuite/g++.dg/pr66655.h5
-rw-r--r--gcc/testsuite/g++.dg/pr66655_1.cc14
4 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 869d0fb..c65c7cb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-07 Nick Clifton <nickc@redhat.com>
+
+ PR target/66655
+ * g++.dg/pr66655.C: New test.
+ * g++.dg/pr66655_1.cc: Test support file.
+ * g++.dg/pr66655.h: Test header file.
+
2016-01-07 Dominique d'Humieres <dominiq@lps.ens.fr>
PR fortran/66680
diff --git a/gcc/testsuite/g++.dg/pr66655.C b/gcc/testsuite/g++.dg/pr66655.C
new file mode 100644
index 0000000..218a2c6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr66655.C
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr66655_1.cc" } */
+
+#include "pr66655.h"
+
+extern "C" void abort (void);
+
+#define COOKIE 0xabcd0123
+
+int
+g (void)
+{
+ return COOKIE;
+}
+
+extern int f (void);
+
+int
+main (void)
+{
+ S::set(0);
+ if (f () != COOKIE)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr66655.h b/gcc/testsuite/g++.dg/pr66655.h
new file mode 100644
index 0000000..ff638f4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr66655.h
@@ -0,0 +1,5 @@
+struct S
+{
+ static int i;
+ static void set (int ii) { i = -ii; }
+};
diff --git a/gcc/testsuite/g++.dg/pr66655_1.cc b/gcc/testsuite/g++.dg/pr66655_1.cc
new file mode 100644
index 0000000..d42344c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr66655_1.cc
@@ -0,0 +1,14 @@
+#include "pr66655.h"
+
+extern int g (void);
+
+int S::i;
+
+int
+f (void)
+{
+ int ret = g ();
+
+ S::set (ret);
+ return ret;
+}