summaryrefslogtreecommitdiff
path: root/test/exception_object_alignment.sh.cpp
blob: 076f45c603faf08f0ec52ac7fdc2de81fd9824be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//===---------------- exception_object_alignment.sh.cpp -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: libcxxabi-no-exceptions

// RUN: %cxx %flags %compile_flags -O1 %s -o %t.exe
// RUN: %exec %t.exe

// This test used to segfault on Darwin because field unwindHeader of struct
// __cxa_exception was not 16B aligned.

namespace {

struct S {
  int a;
  int __attribute__((aligned(16))) b;
};

class base1 {
protected:
  virtual ~base1() throw() {}
};

class derived: public base1 {
public:
  derived() : member() {}
private:
  S member;
};

}

int main() {
  try {
    throw derived();
  }
  catch(...) {
  }
  return 0;
}