Replace g++.dg/pr65802.C with gcc.dg/pr65802.c

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
This commit is contained in:
Tom de Vries 2015-04-24 14:18:57 +00:00 committed by Tom de Vries
parent 97afef00ba
commit 1c3f3851dd
3 changed files with 37 additions and 29 deletions

View File

@ -1,3 +1,12 @@
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>

View File

@ -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 (...)
{
}
}

View File

@ -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);
}