-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Reland][clang][AArch64] Avoid a crash when a non-reserved register i…
…s used (#117419) Relanding the patch with a fix for a test failure on build bots that do not build LLVM for AArch64. Fixes #76426, #109778 (for AArch64) The previous patch for this issue, #94271, generated an error message if a register and a global variable did not have the same size. This patch checks if the register is reserved.
- Loading branch information
1 parent
60380cd
commit afa2fbf
Showing
4 changed files
with
48 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// Check that -ffixed register handled for globals. | ||
/// Regression test for #76426, #109778 | ||
// REQUIRES: aarch64-registered-target | ||
|
||
// RUN: %clang -c --target=aarch64-none-gnu -ffixed-x15 %s 2>&1 | count 0 | ||
|
||
// RUN: not %clang -c --target=aarch64-none-gnu %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=ERR_INVREG | ||
// ERR_INVREG: error: register 'x15' unsuitable for global register variables on this target | ||
|
||
// RUN: not %clang -c --target=aarch64-none-gnu -ffixed-x15 -DTYPE=short %s 2>&1 | \ | ||
// RUN: FileCheck %s --check-prefix=ERR_SIZE | ||
// ERR_SIZE: error: size of register 'x15' does not match variable size | ||
|
||
#ifndef TYPE | ||
#define TYPE long | ||
#endif | ||
|
||
register TYPE x15 __asm__("x15"); | ||
|
||
TYPE foo() { | ||
return x15; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
// RUN: %clang_cc1 -triple aarch64-unknown-none-gnu %s -verify -fsyntax-only | ||
// RUN: %clang_cc1 -triple aarch64-unknown-none-gnu %s -target-feature +reserve-x4 -target-feature +reserve-x15 -verify -verify=no_x18 -fsyntax-only | ||
// RUN: %clang_cc1 -triple aarch64-unknown-android %s -target-feature +reserve-x4 -target-feature +reserve-x15 -verify -fsyntax-only | ||
|
||
register int w0 __asm__ ("w0"); | ||
register long x0 __asm__ ("x0"); | ||
register char i1 __asm__ ("x15"); // expected-error {{size of register 'x15' does not match variable size}} | ||
register long long l2 __asm__ ("w14"); // expected-error {{size of register 'w14' does not match variable size}} | ||
register long long l2 __asm__ ("w15"); // expected-error {{size of register 'w15' does not match variable size}} | ||
register int w3 __asm__ ("w3"); // expected-error {{register 'w3' unsuitable for global register variables on this target}} | ||
register long x3 __asm__ ("x3"); // expected-error {{register 'x3' unsuitable for global register variables on this target}} | ||
register int w4 __asm__ ("w4"); | ||
register long x4 __asm__ ("x4"); | ||
register int w18 __asm__ ("w18"); // no_x18-error {{register 'w18' unsuitable for global register variables on this target}} | ||
register long x18 __asm__ ("x18"); // no_x18-error {{register 'x18' unsuitable for global register variables on this target}} |