2015-04-24 Tom de Vries <tom@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.
From-SVN: r222413
+2015-04-24 Tom de Vries <tom@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.
+
2015-04-24 Uros Bizjak <ubizjak@gmail.com>
Wei Mi <wmi@google.com>
+++ /dev/null
-// { 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 (...)
- {
-
- }
-}
--- /dev/null
+/* { 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);
+}