llvm::SimplifyFortifiedLibCalls::fold crash
| Bugzilla Link | 6807 |
| Resolution | FIXED |
| Resolved on | Apr 13, 2010 11:43 |
| Version | unspecified |
| OS | Linux |
| Attachments | testcase .ll |
| Reporter | LLVM Bugzilla Contributor |
| CC | @lattner,@echristo |
Extended Description
$ llc fortified.ll llc: llvm/lib/VMCore/Value.cpp:317: void llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed. ... llvm::SimplifyFortifiedLibCalls::fold(llvm::CallInst*, llvm::TargetData const*) + 2065 ... Stack dump: 0. Program arguments: llc fortified.ll
- Running pass 'Optimize for code generation' on function '@stpncpy' Aborted (core dumped)
Have no idea how I missed that.
Fixed in r101139.
Found it. Typo :)
Uh. Hrm.
I'll look, thanks.
The original testcase is still failing. I will attach unreduced IR in a moment. In the meantime, here is a new reduced testcase that crashes llc in the same way:
; ModuleID = 'bugpoint-reduced-simplified.bc' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu"
module asm "\09.ident\09\22GCC: (GNU) 4.6.0 20100413 (experimental) LLVM: 101132M\22"
define i32 @stpncpy(i8* %__dest, i8* %__src, i64 %__n) nounwind {
entry:
%0 = tail call i64 @llvm.objectsize.i64(i8* %__dest, i1 false) ;
"5": ; preds = %entry
%1 = tail call i32 (...)* @__stpncpy_chk(i8* %__dest, i8* %__src, i64 %__n, i64 %0) nounwind ;
return: ; preds = %entry ret i32 undef }
declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly
declare i32 @__stpncpy_chk(...)
Aaah. It looks like a delta reduced testcase that just threw away the return type. No worries :)
Fixed with:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20100405/099620.html
Need to look at the testcase and see if we're still doing something wrong with the function - that return type looks... odd.
Thanks!
Original C testcase This is ssa-dse-10.c from the gcc testsuite.
Hmm.. good point. I think those checks were lost when we ... someone... rewrote this section. I'll fix that stuff up.
It doesn't matter, the compiler should never crash. It should validate that the prototype looks ok and if not, refuse to transform it.
Duncan: What's the original C code look like for this? I'm looking at a return value of i32 which doesn't match the spec I have for stpncpy...
Looking.