Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile libc on m68k-unknown-linux-gnu: LLVM ERROR: unable to allocate function return #2 #93940

Open
glaubitz opened this issue Feb 12, 2022 · 5 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-motorola68k Target: Rust from the parallel universe where the Amiga won. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@glaubitz
Copy link
Contributor

Building libc for m68k-unknown-linux-gnu currently fails an LLVM error:

Building stage1 std artifacts (x86_64-unknown-linux-gnu -> m68k-unknown-linux-gnu)
   Compiling core v0.0.0 (/data/home/glaubitz/rust-m68k/library/core)
   Compiling compiler_builtins v0.1.67
   Compiling libc v0.2.116
   Compiling memchr v2.4.1
   Compiling unwind v0.0.0 (/data/home/glaubitz/rust-m68k/library/unwind)
   Compiling std v0.0.0 (/data/home/glaubitz/rust-m68k/library/std)
   Compiling rustc-std-workspace-core v1.99.0 (/data/home/glaubitz/rust-m68k/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/data/home/glaubitz/rust-m68k/library/alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.21
LLVM ERROR: unable to allocate function return #2
error: could not compile `libc`
warning: build failed, waiting for other jobs to finish...
LLVM ERROR: unable to allocate function return #2
rustc: /data/home/glaubitz/llvm-project/llvm/lib/Target/M68k/M68kInstrInfo.cpp:763: virtual void llvm::M68kInstrInfo::storeRegToStackSlot(llvm::MachineBasicBlock&, llvm::MachineBasicBlock::iterator, llvm::Register, bool, int, const llvm::TargetRegisterClass*, const llvm::TargetRegisterInfo*) const: Assertion `MF.getFrameInfo().getObjectSize(FrameIndex) == 4 && "Stack slot too small for store"' failed.
rustc exited with signal: 6 (core dumped)
rustc: /data/home/glaubitz/llvm-project/llvm/lib/Target/M68k/M68kInstrInfo.cpp:763: virtual void llvm::M68kInstrInfo::storeRegToStackSlot(llvm::MachineBasicBlock&, llvm::MachineBasicBlock::iterator, llvm::Register, bool, int, const llvm::TargetRegisterClass*, const llvm::TargetRegisterInfo*) const: Assertion `MF.getFrameInfo().getObjectSize(FrameIndex) == 4 && "Stack slot too small for store"' failed.
rustc exited with signal: 6 (core dumped)
rustc: /data/home/glaubitz/llvm-project/llvm/lib/Target/M68k/M68kInstrInfo.cpp:763: virtual void llvm::M68kInstrInfo::storeRegToStackSlot(llvm::MachineBasicBlock&, llvm::MachineBasicBlock::iterator, llvm::Register, bool, int, const llvm::TargetRegisterClass*, const llvm::TargetRegisterInfo*) const: Assertion `MF.getFrameInfo().getObjectSize(FrameIndex) == 4 && "Stack slot too small for store"' failed.
rustc exited with signal: 6 (core dumped)
rustc: /data/home/glaubitz/llvm-project/llvm/lib/CodeGen/LiveVariables.cpp:129: void llvm::LiveVariables::HandleVirtRegUse(llvm::Register, llvm::MachineBasicBlock*, llvm::MachineInstr&): Assertion `MRI->getVRegDef(Reg) && "Register use before def!"' failed.
rustc exited with signal: 6 (core dumped)
error: build failed
Build completed unsuccessfully in 0:06:30

Not sure whether this is a Rust or an LLVM bug.

CC @mshockwave @0x59616e @jrtc27 @ricky26 @AnnikaCodes

@0x59616e
Copy link

0x59616e commented Feb 12, 2022

Interesting, I'll take a look in the next few days. 😄

It'll be great if you can provide a minimal code that can reproduce the problem or any useful information such as the source code you build. @glaubitz

@ketsuban
Copy link
Contributor

This appears at first blush to be a duplicate of #89498.

@ricky26
Copy link
Contributor

ricky26 commented Feb 12, 2022

Yep, this will be due to the same issue, non-32-bit returns (I think the same code affects all stack saves though).

@glaubitz
Copy link
Contributor Author

Oh, I actually commented on that bug earlier today without realizing its the same issue. 🤦‍♂️

@glaubitz
Copy link
Contributor Author

Interesting, I'll take a look in the next few days. smile

It'll be great if you can provide a minimal code that can reproduce the problem or any useful information such as the source code you build. @glaubitz

This seems to be a bug in the Rust compiler and not LLVM. See #89498.

@nagisa nagisa added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ and removed A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Feb 12, 2022
@workingjubilee workingjubilee added the O-motorola68k Target: Rust from the parallel universe where the Amiga won. label Feb 4, 2023
@workingjubilee workingjubilee added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Mar 4, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-motorola68k Target: Rust from the parallel universe where the Amiga won. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants