mirror of https://github.com/llvm-mirror/libcxxabi
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1007 B
C++
35 lines
1007 B
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: libcxxabi-no-exceptions
|
|
|
|
// This test checks that the compiler does not make incorrect assumptions
|
|
// about the alignment of the exception (only in that specific case, of
|
|
// course).
|
|
//
|
|
// There was a bug where Clang would emit a call to memset assuming a 16-byte
|
|
// aligned exception even when back-deploying to older Darwin systems where
|
|
// exceptions are 8-byte aligned, which caused a segfault on those systems.
|
|
|
|
struct exception {
|
|
exception() : x(0) { }
|
|
virtual ~exception() { }
|
|
int x;
|
|
};
|
|
|
|
struct foo : exception { };
|
|
|
|
int main() {
|
|
try {
|
|
throw foo();
|
|
} catch (...) {
|
|
|
|
}
|
|
return 0;
|
|
}
|