From 5a84efd3f60af101e802bef5ecc817b315eecc71 Mon Sep 17 00:00:00 2001 From: ktietz Date: Fri, 9 Apr 2010 08:52:54 +0000 Subject: [PATCH] 2010-04-09 Kai Tietz * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158153 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/g++.dg/other/pr35504.C | 12 ++++++ .../g++.dg/torture/stackalign/eh-thiscall-1.C | 43 ++++++++++++++++++++++ .../gcc.dg/torture/stackalign/thiscall-1.c | 31 ++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C create mode 100644 gcc/testsuite/gcc.dg/torture/stackalign/thiscall-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 17277cf..09aa4cc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-04-09 Kai Tietz + + * 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 PR c++/28584 diff --git a/gcc/testsuite/g++.dg/other/pr35504.C b/gcc/testsuite/g++.dg/other/pr35504.C index 09c13fd..58422f2 100644 --- a/gcc/testsuite/g++.dg/other/pr35504.C +++ b/gcc/testsuite/g++.dg/other/pr35504.C @@ -8,6 +8,7 @@ #define ATTR5 __attribute__((__stdcall__)) #define ATTR6 __attribute__((__cdecl__)) #define ATTR7 +#define ATTR8 __attribute__((__thiscall__)) extern "C" void abort (void); @@ -69,6 +70,11 @@ public: { return ret; } + + virtual ATTR8 struct long_struct method8 () + { + return ret; + } }; class c3:c1, public c2 @@ -126,6 +132,11 @@ public: { return check_this (7); } + + virtual ATTR8 struct long_struct method8 () + { + return check_this (7); + } }; class c3 c3_instance; @@ -142,6 +153,7 @@ main () c2_ptr->method5 (); c2_ptr->method6 (); c2_ptr->method7 (); + c2_ptr->method8 (); return 0; } diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C new file mode 100644 index 0000000..de9bed5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C @@ -0,0 +1,43 @@ +/* { 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; +} diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/thiscall-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/thiscall-1.c new file mode 100644 index 0000000..6f22e07 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/stackalign/thiscall-1.c @@ -0,0 +1,31 @@ +/* { 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; +} -- 2.7.4