ziglang / zig

General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.
https://ziglang.org
MIT License
35.12k stars 2.56k forks source link

ppc inline assembly segfaults when touching crX registers #9208

Open fengb opened 3 years ago

fengb commented 3 years ago

This is a potential LLVM12 regression, as it had previously worked fine.

// zig build-obj crash.zig -target powerpc-freestanding-eabi
export fn sysret(value: u32, errored: bool) void {
    _ = asm volatile ("rfi"
        : [ret] "={r3}" (-> usize)
        : [value] "{r3}" (value),
          [err] "{cr0}" (errored)
              // cr0 - cr7 crashes the compiler
              // cr8 detects as not a real register
              // rX works just fine
    );
}
nektro commented 3 years ago

so this works on 0.7.1 and segfaults on 0.8.0 ?