view gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "--save-temps" } */
/* { dg-require-effective-target arm_v8_3a_bkey_directive } */

__attribute__((target("branch-protection=pac-ret+leaf")))
int foo_a () {
  throw 22;
}

__attribute__((target("branch-protection=pac-ret+leaf+b-key")))
int foo_b () {
  throw 22;
}

int main (int argc, char** argv) {
  try {
    foo_a ();
  } catch (...) {
    try {
      foo_b ();
    } catch (...) {
      return 0;
    }
  }
  return 1;
}

/* { dg-final { scan-assembler-times "paciasp" 1 } } */
/* { dg-final { scan-assembler-times "pacibsp" 1 } } */
/* { dg-final { scan-assembler-times ".cfi_b_key_frame" 1 } } */