[llvm-bugs] [Bug 30783] New: Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 25 06:53:28 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30783

            Bug ID: 30783
           Summary: Assertion `New->getType() == getType() &&
                    "replaceAllUses of value with new value of different
                    type!"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Vsevolod.Livinskij at frtk.ru
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17485
  --> https://llvm.org/bugs/attachment.cgi?id=17485&action=edit
Reproducer.

Assertion `New->getType() == getType() && "replaceAllUses of value with new
value of different type!"' failed. Same error was in 27969 (Fixed), but it
can't be reproduced in trunk.

================================================================================

Reproducer:
#include <array>
#include <valarray>
int a, c;
std::vector<std::vector<std::vector<bool>>> b;
std::array<std::array<int, 9>, 3> e;
void f() {
  for (int d = 0; d < c; d = d + 1)
    *(d + (*e.begin()).begin()) = (~(*(*b.begin()).begin())[d] < a) + 9;
}

================================================================================
LLVM version:

clang version 4.0.0 (trunk 284990)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vlivinsk/workspace/llvm/bin-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

================================================================================

Error:
>$ clang++ -std=c++11 -O3 -march=knl -o small.o -c small.cpp
clang-4.0: /home/vlivinsk/workspace/llvm/llvm-trunk/lib/IR/Value.cpp:375: void
llvm::Value::replaceAllUsesWith(llvm::Value*): Assertion `New->getType() ==
getType() && "replaceAllUses of value with new value of different type!"'
failed.
#0 0x00000000014298b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x14298b8)
#1 0x000000000142750e llvm::sys::RunSignalHandlers()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x142750e)
#2 0x0000000001427682 SignalHandler(int)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1427682)
#3 0x00007ff8a95893d0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x113d0)
#4 0x00007ff8a873f418 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35418)
#5 0x00007ff8a874101a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3701a)
#6 0x00007ff8a8737bd7 (/lib/x86_64-linux-gnu/libc.so.6+0x2dbd7)
#7 0x00007ff8a8737c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x000000000107cb03
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x107cb03)
#9 0x00000000010f8aac
llvm::InstCombiner::replaceInstUsesWith(llvm::Instruction&, llvm::Value*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x10f8aac)
#10 0x00000000011011a3
llvm::InstCombiner::visitGetElementPtrInst(llvm::GetElementPtrInst&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x11011a3)
#11 0x0000000001106a60 llvm::InstCombiner::run()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1106a60)
#12 0x000000000110887f combineInstructionsOverFunction(llvm::Function&,
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&,
llvm::TargetLibraryInfo&, llvm::DominatorTree&, bool, llvm::LoopInfo*) [clone
.constprop.750]
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x110887f)
#13 0x0000000001108c70
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1108c70)
#14 0x000000000103f803 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f803)
#15 0x000000000103f8cc llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f8cc)
#16 0x000000000103f36d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x103f36d)
#17 0x00000000015b34a4 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x15b34a4)
#18 0x0000000001be2623
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1be2623)
#19 0x0000000001fc4f38 clang::ParseAST(clang::Sema&, bool, bool)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1fc4f38)
#20 0x0000000001bdda69 clang::CodeGenAction::ExecuteAction()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x1bdda69)
#21 0x00000000018eee16 clang::FrontendAction::Execute()
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x18eee16)
#22 0x00000000018c1146
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x18c1146)
#23 0x00000000019748a2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x19748a2)
#24 0x000000000091d048 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x91d048)
#25 0x00000000008dfa54 main
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x8dfa54)
#26 0x00007ff8a872a830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#27 0x0000000000919a19 _start
(/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0+0x919a19)
Stack dump:
0.      Program arguments:
/home/vlivinsk/workspace/llvm/bin-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.cpp
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu knl
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb
-coverage-notes-file
/home/vlivinsk/workspace/yarpgen/found/loop/clang/S_2958115511/small.gcno
-resource-dir /home/vlivinsk/workspace/llvm/bin-trunk/bin/../lib/clang/4.0.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/vlivinsk/workspace/llvm/bin-trunk/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/vlivinsk/workspace/yarpgen/found/loop/clang/S_2958115511 -ferror-limit 19
-fmessage-length 114 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -vectorize-loops -vectorize-slp -o small.o -x c++
small.cpp
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'small.cpp'.
4.      Running pass 'Combine redundant instructions' on function '@_Z1fv'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 284990)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vlivinsk/workspace/llvm/bin-trunk/bin
clang-4.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-4.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-934527.cpp
clang-4.0: note: diagnostic msg: /tmp/small-934527.sh
clang-4.0: note: diagnostic msg:

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161025/c0008a5f/attachment-0001.html>


More information about the llvm-bugs mailing list