Hi Jeff,

You probably know the capabilities of COFF/PE better than I, so the
patch itself is fine.

Thanks - committed.

Is there any way that test can be shoved into our dejagnu testing
harness?  I think we've got support somewhere for tests which require
multiple input files.

dg-additional-sources is the command that you are thinking about.


The attached patch adds the test derived from the BZ. There is one small problem - I could not find a way to stop the additional source file from being compiled as a test on its own. When I investigated however it seems that is a common problem for all tests that use additional source files, so I do not think that it is a big issue.

Tested with no regressions on an x86_64-pc-linux-gnu toolchain.

OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2016-01-05  Nick Clifton  <ni...@redhat.com>

        PR target/66655
        * g++.dg/pr66655.C: New test.
        * g++.dg/pr66655_1.C: Additional source file for the test.
        * g++.dg/pr66655.h: Header file for the test.
--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655.C	2016-01-05 10:42:01.769654305 +0000
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr66655_1.C" } */
+
+#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;
+}
--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655_1.C	2016-01-05 10:41:23.266433205 +0000
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include "pr66655.h"
+
+extern int g (void);
+
+int S::i;
+
+int
+f (void)
+{
+  int ret = g ();
+
+  S::set (ret);
+  return ret;
+}
--- /dev/null	2016-01-05 08:31:00.212966083 +0000
+++ gcc/testsuite/g++.dg/pr66655.h	2016-01-05 10:41:45.629561622 +0000
@@ -0,0 +1,5 @@
+struct S
+{
+  static int i;
+  static void set (int ii) { i = -ii; }
+};

Reply via email to