| Issue |
76426
|
| Summary |
[AArch64] Crash when compiling global register variable __asm__("x15") without -ffixed-x15
|
| Labels |
backend:AArch64,
crash-on-invalid
|
| Assignees |
|
| Reporter |
arakawamasahiro-fj
|
clang in AArch64 environment, fatal error at compile time.
If a global register variable associated with the register x15 is defined in the program and referenced in the program, a fatal error occurs at compile time when -ffixed-x15 is not specified.
When -ffixed-x15 is specified, it can be compiled.
Though failing to compile without -ffixed-x15 may be intentional, it should not be a fatal error.
Here is the program and compilation log:
[program]
```c
register int i1 __asm__("x15");
int foo(int i) {
return i1;
}
int main() {
return 0;
}
```
[compile log]
```
$ clang test_x15.c
fatal error: error in backend: Invalid register name "x15".
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.0.0 (https://github.com/llvm/llvm-project.git fe846bc9bd164ed89cef1caefb681e0aee3d4dec)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/home/marakawa/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test_x15-659ab1.c
clang: note: diagnostic msg: /tmp/test_x15-659ab1.sh
clang: note: diagnostic msg:
********************
$
```
[test_x15-659ab1.c]
```
# 1 "<built-in>"
# 1 "test_x15.c"
register int i1 __asm__("x15");
int foo(int i) {
return i1;
}
int main() {
return 0;
}
```
[test_x15-659ab1.sh]
```
# Crash reproducer for clang version 18.0.0 (https://github.com/llvm/llvm-project.git fe846bc9bd164ed89cef1caefb681e0aee3d4dec)
# Driver args: "test_x15.c"
# Original command: "/work/home/marakawa/LLVM/llvm-project/installs/release/bin/clang-18" "-cc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test_x15.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=non-leaf" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8a" "-target-abi" "aapcs" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/work/home/marakawa/test/local_test/1179_fatal" "-fcoverage-compilation-dir=/work/home/marakawa/test/local_test/1179_fatal" "-resource-dir" "/work/home/marakawa/LLVM/llvm-project/installs/release/lib/clang/18" "-internal-isystem" "/work/home/marakawa/LLVM/llvm-project/installs/release/lib/clang/18/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/aarch64-redhat-linux/12/../../../../aarch64-redhat-linux/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-ferror-limit" "19" "-fno-signed-char" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-target-feature" "+outline-atomics" "-target-feature" "-fmv" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/tmp/test_x15-518c67.o" "-x" "c" "test_x15.c"
"/work/home/marakawa/LLVM/llvm-project/installs/release/bin/clang-18" "-cc1" "-triple" "aarch64-unknown-linux-gnu" "-emit-obj" "-mrelax-all" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test_x15.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=non-leaf" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8a" "-target-abi" "aapcs" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/work/home/marakawa/test/local_test/1179_fatal" "-fcoverage-compilation-dir=/work/home/marakawa/test/local_test/1179_fatal" "-ferror-limit" "19" "-fno-signed-char" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-target-feature" "+outline-atomics" "-target-feature" "-fmv" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c" "test_x15-659ab1.c"
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs