On 24-04-15 05:25, Bin.Cheng wrote:
On Tue, Apr 21, 2015 at 3:10 PM, Tom de Vries <tom_devr...@mentor.com> wrote:
Hi,

this patch fixes PR65802.

diff --git a/gcc/testsuite/g++.dg/
pr65802.C b/gcc/testsuite/g++.dg/pr65802.C
new file mode 100644
index 0000000..26e5317
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr65802.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-O0" }
+
+typedef int tf ();
+
+struct S
+{
+  tf m_fn1;
+} a;
+
+void
+fn1 ()
+{
+  try
+    {
+      __builtin_va_list c;
+      {
+     int *d = __builtin_va_arg (c, int *);
+     int **e = &d;
+     __asm__("" : "=d"(e));
Hi, thanks for fixing the issue.
But 'd' is a machine specific constraint?  This case failed on all arm
processors.

Hi,

I've rewritten the test-case for C, made the function a valid stdargs function, and removed the superfluous inline assembly.

Committed as attached.

Thanks,
- Tom
2015-04-24  Tom de Vries  <t...@codesourcery.com>

	PR tree-optimization/65802
	* g++.dg/pr65802.C: Move to ...
	* gcc.dg/pr65802.c: ... here.  Add -fexceptions to dg-options. Include
	stdarg.h.  Rewrite for C.
	(fn1): Use va_list and va_arg.  Make variable args function.  Add use of
	va_start and va_end.  Remove unnecessary inline asm.

diff --git a/gcc/testsuite/g++.dg/pr65802.C b/gcc/testsuite/g++.dg/pr65802.C
deleted file mode 100644
index 26e5317..0000000
--- a/gcc/testsuite/g++.dg/pr65802.C
+++ /dev/null
@@ -1,29 +0,0 @@
-// { dg-do compile }
-// { dg-options "-O0" }
-
-typedef int tf ();
-
-struct S
-{
-  tf m_fn1;
-} a;
-
-void
-fn1 ()
-{
-  try
-    {
-      __builtin_va_list c;
-      {
-	int *d = __builtin_va_arg (c, int *);
-	int **e = &d;
-	__asm__("" : "=d"(e));
-	a.m_fn1 ();
-      }
-      a.m_fn1 ();
-    }
-  catch (...)
-    {
-
-    }
-}
diff --git a/gcc/testsuite/gcc.dg/pr65802.c b/gcc/testsuite/gcc.dg/pr65802.c
new file mode 100644
index 0000000..fcec234
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr65802.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -fexceptions" } */
+
+#include <stdarg.h>
+
+struct S
+{
+  int (*m_fn1) (void);
+} a;
+
+void
+fn1 (int d, ...)
+{
+  va_list c;
+  va_start (c, d);
+
+  {
+    int *d = va_arg (c, int *);
+
+    int **e = &d;
+
+    a.m_fn1 ();
+  }
+
+  a.m_fn1 ();
+
+  va_end (c);
+}
-- 
1.9.1

Reply via email to