16 static volatile uint64_t
sink;
19 extern "C" __attribute__((noinline))
void rethrow_outer_try_marker(
int i) {
20 __asm__ __volatile__(
"" :::
"memory");
sink ^= (uint64_t)i;
22 extern "C" __attribute__((noinline))
void rethrow_inner_try_marker(
int i) {
23 __asm__ __volatile__(
"" :::
"memory");
sink ^= (uint64_t)i << 4;
25 extern "C" __attribute__((noinline))
void rethrow_inner_catch_marker(
int i) {
26 __asm__ __volatile__(
"" :::
"memory");
sink ^= (uint64_t)i << 8;
28 extern "C" __attribute__((noinline))
void rethrow_outer_catch_marker(
int i) {
29 __asm__ __volatile__(
"" :::
"memory");
sink ^= (uint64_t)i << 12;
34 throw std::runtime_error(
"first");
39 rethrow_inner_try_marker(i);
41 }
catch (
const std::exception& e) {
42 rethrow_inner_catch_marker(i);
50 int main(
int argc,
char** argv) {
51 (void)argc; (void)argv;
53 for (
int i = 0; i <
ITERS; ++i)
buf[i] = 0x22;
54 for (
int i = 0; i <
ITERS; ++i) {
56 rethrow_outer_try_marker(i);
58 }
catch (
const std::exception&) {
59 rethrow_outer_catch_marker(i);
65 fprintf(stderr,
"exc_rethrow: caught=%d iters=%d sink=%llx\n",
67 return caught ==
ITERS ? 0 : 1;
int main(int argc, char **argv)
static uint64_t buf[ITERS]
static void raise_it(int i)
__attribute__((noinline)) void rethrow_outer_try_marker(int i)
static volatile uint64_t sink