Commit c688a8b0 by Kai Tietz Committed by Kai Tietz

pr35504.C: Add check for thiscall.

2010-04-09  Kai Tietz  <kai.tietz@onevision.com>

        * g++.dg/other/pr35504.C: Add check for thiscall.
        * g++.dg/torture/stackalign/eh-thiscall-1.C: New.
        * gcc.dg/torture/stackalign/thiscall-1.c: New.

From-SVN: r158153
parent dc8d2739
2010-04-09 Kai Tietz <kai.tietz@onevision.com>
* g++.dg/other/pr35504.C: Add check for thiscall.
* g++.dg/torture/stackalign/eh-thiscall-1.C: New.
* gcc.dg/torture/stackalign/thiscall-1.c: New.
2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org> 2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/28584 PR c++/28584
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define ATTR5 __attribute__((__stdcall__)) #define ATTR5 __attribute__((__stdcall__))
#define ATTR6 __attribute__((__cdecl__)) #define ATTR6 __attribute__((__cdecl__))
#define ATTR7 #define ATTR7
#define ATTR8 __attribute__((__thiscall__))
extern "C" void abort (void); extern "C" void abort (void);
...@@ -69,6 +70,11 @@ public: ...@@ -69,6 +70,11 @@ public:
{ {
return ret; return ret;
} }
virtual ATTR8 struct long_struct method8 ()
{
return ret;
}
}; };
class c3:c1, public c2 class c3:c1, public c2
...@@ -126,6 +132,11 @@ public: ...@@ -126,6 +132,11 @@ public:
{ {
return check_this (7); return check_this (7);
} }
virtual ATTR8 struct long_struct method8 ()
{
return check_this (7);
}
}; };
class c3 c3_instance; class c3 c3_instance;
...@@ -142,6 +153,7 @@ main () ...@@ -142,6 +153,7 @@ main ()
c2_ptr->method5 (); c2_ptr->method5 ();
c2_ptr->method6 (); c2_ptr->method6 ();
c2_ptr->method7 (); c2_ptr->method7 ();
c2_ptr->method8 ();
return 0; return 0;
} }
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
#include "check.h"
#ifndef ALIGNMENT
#define ALIGNMENT 64
#endif
typedef int aligned __attribute__((aligned(ALIGNMENT)));
int global;
class Base {};
struct A : virtual public Base
{
A() {}
};
struct B {};
__attribute__ ((thiscall))
void
foo (int j, int k, int m, int n, int o) throw (B,A)
{
aligned i;
if (check_int (&i, __alignof__(i)) != i)
abort ();
if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
abort ();
throw A();
}
int
main()
{
try { foo (1, 2, 3, 4, 5); }
catch (A& a) { }
return 0;
}
/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
#include "check.h"
#ifndef ALIGNMENT
#define ALIGNMENT 64
#endif
typedef int aligned __attribute__((aligned(ALIGNMENT)));
int global;
__attribute__ ((thiscall))
void
foo (int j, int k, int m, int n, int o)
{
aligned i;
if (check_int (&i, __alignof__(i)) != i)
abort ();
if (i != 20 || j != 1 || k != 2 || m != 3 || n != 4 || o != 5)
abort ();
}
int
main()
{
foo (1, 2, 3, 4, 5);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment