[SOLVED] Possible LLVM bug? "Calling a function with bad signature"


#1

Created a test here:

https://github.com/johalun/llvm-test-bug

README:

llvm-test-bug

Tested with:

rustc 1.16.0-nightly (7821a9b99 2017-01-23)

Build with:

xargo build --target x86_64-kernel-freebsd

this code

lazy_static! {
   pub static ref X: i32 = 0i32;
}

causes error:

Assertion failed: ((Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"), function init, file /buildslave/rust-buildbot/slave/nightly-dist-rustc-cross-host-linux/build/src/llvm/lib/IR/Instructions.cpp, line 258.

Target configuration

{
	"llvm-target": "x86_64-unknown-freebsd",
	"target-endian": "little",
	"target-pointer-width": "64",
	"os": "none",
	"arch": "x86_64",
	"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
	"pre-link-args": [ "-m64" ],
	"cpu": "x86-64",
	"features": "+soft-float,-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2",
	"disable-redzone":         true,
	"custom-unwind-resume":    true,
	"eliminate-frame-pointer": true,
	"linker-is-gnu":           true,
	"no-compiler-rt":          true,
	"archive-format":          "gnu",
	"code-model":              "kernel",
	"relocation-model":        "static"
}

#2

Causing an error at build time or at runtime? If rustc is crashing when compiling code, you should for sure open a bug report in the github issue tracker


#3

Sorry, yes crash at compile time. I will debug the core dump later when I get some free time.


#4

https://github.com/rust-lang/rust/issues/39543


#5

This was fixed with

[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"

Thought I’d already added it to Cargo.toml but must have gotten lost somewhere…