| 1 |
// RUN: %clang_cc1 -triple arm64e-apple-darwin -fsyntax-only -verify %s -fptrauth-indirect-gotos |
| 2 |
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s -fptrauth-indirect-gotos |
| 3 |
|
| 4 |
int f() { |
| 5 |
static void *addrs[] = { &&l1, &&l2 }; |
| 6 |
|
| 7 |
static int diffs[] = { |
| 8 |
&&l1 - &&l1, // expected-error{{subtraction of address-of-label expressions is not supported with ptrauth indirect gotos}} |
| 9 |
&&l1 - &&l2 // expected-error{{subtraction of address-of-label expressions is not supported with ptrauth indirect gotos}} |
| 10 |
}; |
| 11 |
|
| 12 |
int diff_32 = &&l1 - &&l2; // expected-error{{subtraction of address-of-label expressions is not supported with ptrauth indirect gotos}} |
| 13 |
goto *(&&l1 + diff_32); // expected-error{{addition of address-of-label expressions is not supported with ptrauth indirect gotos}} |
| 14 |
|
| 15 |
l1: |
| 16 |
return 0; |
| 17 |
l2: |
| 18 |
return 1; |
| 19 |
} |