Issue 109588
Summary [clang] fatal error when using register keyword on riscv64 target
Labels clang
Assignees
Reporter Mintia11
    ```
fatal error: error in backend: Do not know how to promote this operator's operand!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -I include -pipe -Wall -Wextra -DTARGET_riscv64 -DKERNEL -O2 -target riscv64-unknown-none -fno-omit-frame-pointer -std=c11 -ffreestanding -fno-stack-protector -fno-stack-check -fno-lto -fno-pie -fno-pic -MMD -MP -I. -march=rv64imac -mabi=lp64 -mno-relax -c src/ke/init.c -o ../build/beryl/ke/init.o
1.      <eof> parser at end of file
2. Code generation
3.      Running pass 'Function Pass Manager' on module 'src/ke/init.c'.
4.      Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@KiSystemStartup'k
```

Source code
```c
#include <beryl.h>

register volatile int a __asm__("x4");

NO_RETURN void
KiSystemStartup(void)
{
    a = 0;

    while (true)
        ;
}
```

Preprocessed source code
```c
# 1 "src/ke/init.c"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 372 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "src/ke/init.c" 2
# 1 "include/beryl.h" 1



# 1 "include/main.h" 1
# 5 "include/beryl.h" 2

# 1 "/usr/lib/clang/18/include/stdbool.h" 1 3
# 7 "include/beryl.h" 2
# 2 "src/ke/init.c" 2

register volatile int a __asm__("x4");

__attribute__((noreturn)) void
KiSystemStartup(void)
{
    a = 0;

    while (1)
 ;
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to