annotate libcxxabi/test/exception_object_alignment.2.pass.cpp @ 192:d7606dcf6fce

Added tag llvm10 for changeset 0572611fdcc8
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 14 Dec 2020 18:01:34 +0900
parents 0572611fdcc8
children 2e18cbf3894f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
173
0572611fdcc8 reorgnization done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9 // UNSUPPORTED: no-exceptions
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 // This test checks that the compiler does not make incorrect assumptions
anatofuz
parents:
diff changeset
12 // about the alignment of the exception (only in that specific case, of
anatofuz
parents:
diff changeset
13 // course).
anatofuz
parents:
diff changeset
14 //
anatofuz
parents:
diff changeset
15 // There was a bug where Clang would emit a call to memset assuming a 16-byte
anatofuz
parents:
diff changeset
16 // aligned exception even when back-deploying to older Darwin systems where
anatofuz
parents:
diff changeset
17 // exceptions are 8-byte aligned, which caused a segfault on those systems.
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 struct exception {
anatofuz
parents:
diff changeset
20 exception() : x(0) { }
anatofuz
parents:
diff changeset
21 virtual ~exception() { }
anatofuz
parents:
diff changeset
22 int x;
anatofuz
parents:
diff changeset
23 };
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 struct foo : exception { };
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 int main() {
anatofuz
parents:
diff changeset
28 try {
anatofuz
parents:
diff changeset
29 throw foo();
anatofuz
parents:
diff changeset
30 } catch (...) {
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 }
anatofuz
parents:
diff changeset
33 return 0;
anatofuz
parents:
diff changeset
34 }