llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

llvm::SimplifyFortifiedLibCalls::fold crash

Open llvmbot opened this issue 16 years ago • 13 comments

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

  1. Running pass 'Optimize for code generation' on function '@stpncpy' Aborted (core dumped)

llvmbot avatar Apr 09 '10 18:04 llvmbot

Have no idea how I missed that.

Fixed in r101139.

echristo avatar Apr 13 '10 18:04 echristo

Found it. Typo :)

echristo avatar Apr 13 '10 18:04 echristo

Uh. Hrm.

I'll look, thanks.

echristo avatar Apr 13 '10 18:04 echristo

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) ; [#uses=1] br i1 undef, label %return, label %"5"

"5": ; preds = %entry %1 = tail call i32 (...)* @​__stpncpy_chk(i8* %__dest, i8* %__src, i64 %__n, i64 %0) nounwind ; [#uses=1] ret i32 %1

return: ; preds = %entry ret i32 undef }

declare i64 @​llvm.objectsize.i64(i8*, i1) nounwind readonly

declare i32 @​__stpncpy_chk(...)

llvmbot avatar Apr 13 '10 18:04 llvmbot

Aaah. It looks like a delta reduced testcase that just threw away the return type. No worries :)

echristo avatar Apr 12 '10 07:04 echristo

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.

echristo avatar Apr 12 '10 06:04 echristo

Thanks!

echristo avatar Apr 09 '10 22:04 echristo

Original C testcase This is ssa-dse-10.c from the gcc testsuite.

llvmbot avatar Apr 09 '10 22:04 llvmbot

Hmm.. good point. I think those checks were lost when we ... someone... rewrote this section. I'll fix that stuff up.

echristo avatar Apr 09 '10 22:04 echristo

It doesn't matter, the compiler should never crash. It should validate that the prototype looks ok and if not, refuse to transform it.

lattner avatar Apr 09 '10 22:04 lattner

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...

echristo avatar Apr 09 '10 21:04 echristo

Looking.

echristo avatar Apr 09 '10 20:04 echristo