[llvm-bugs] [Bug 34759] New: clang crashes on valid code at -O2 and -O3 on x86_64-linux-gnu: Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 27 23:07:58 PDT 2017


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

            Bug ID: 34759
           Summary: clang crashes on valid code at -O2 and -O3 on
                    x86_64-linux-gnu: Assertion `New->getType() ==
                    getType() && "replaceAllUses of value with new value
                    of different type!"' failed
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

This is tested with rev. 314335. 

$ clangpolly -v
clang version 6.0.0 (http://llvm.org/git/clang.git
31a16c4f5bc89d8e9ca6c0a52a34b98c18058b6b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.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.2.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clangpolly -Os small.c
$          
$ clangpolly -O2 small.c
clang-6.0: /home/su/software/tmp/polly/llvm/lib/IR/Value.cpp:402: void
llvm::Value::doRAUW(llvm::Value*, bool): Assertion `New->getType() == getType()
&& "replaceAllUses of value with new value of different type!"' failed.
#0 0x00000000022f9e3a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x00000000022f7fde llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:50:0
#2 0x00000000022f8140 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007f7710e52330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f770fc3ac37 gsignal
/build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f770fc3e028 abort
/build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f770fc33bf6 __assert_fail_base
/build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f770fc33ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001ec7176 llvm::Value::doRAUW(llvm::Value*, bool)
/home/su/software/tmp/polly/llvm/lib/IR/Value.cpp:399:0
#9 0x00000000023c448e foldConstantSCEV
/home/su/software/tmp/polly/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:552:0
#10 0x00000000023c448e simplifyUsers
/home/su/software/tmp/polly/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:771:0
#11 0x00000000023c448e llvm::simplifyUsersOfIV(llvm::PHINode*,
llvm::ScalarEvolution*, llvm::DominatorTree*, llvm::LoopInfo*,
llvm::SmallVectorImpl<llvm::WeakTrackingVH>&, llvm::IVVisitor*)
/home/su/software/tmp/polly/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:822:0
#12 0x000000000214e104 simplifyAndExtend
/home/su/software/tmp/polly/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1762:0
#13 0x000000000214e104 (anonymous namespace)::IndVarSimplify::run(llvm::Loop*)
[clone .part.640]
/home/su/software/tmp/polly/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2403:0
#14 0x00000000021508f3 (anonymous
namespace)::IndVarSimplifyLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) [clone .part.641]
/home/su/software/tmp/polly/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:2524:0
#15 0x00000000019f77ab llvm::LPPassManager::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/Analysis/LoopPass.cpp:196:0
#16 0x0000000001e8d1db llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1514:0
#17 0x0000000001976e06 RunPassOnSCC
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:156:0
#18 0x0000000001976e06 RunAllPassesOnSCC
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:424:0
#19 0x0000000001976e06 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/Analysis/CallGraphSCCPass.cpp:479:0
#20 0x0000000001e8deea runOnModule
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1591:0
#21 0x0000000001e8deea llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1694:0
#22 0x0000000002488aa5 ~PrettyStackTraceString
/home/su/software/tmp/polly/llvm/include/llvm/Support/PrettyStackTrace.h:52:0
#23 0x0000000002488aa5 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:789:0
#24 0x0000000002489e80 ~unique_ptr /usr/include/c++/4.9/bits/unique_ptr.h:235:0
#25 0x0000000002489e80 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, 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/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1145:0
#26 0x0000000002c9065c ~unique_ptr /usr/include/c++/4.9/bits/unique_ptr.h:235:0
#27 0x0000000002c9065c
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:294:0
#28 0x0000000002e6843c swap<bool> /usr/include/c++/4.9/bits/move.h:177:0
#29 0x0000000002e6843c clang::ParseAST(clang::Sema&, bool, bool)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Parse/ParseAST.cpp:161:0
#30 0x0000000002c8faf0 clang::CodeGenAction::ExecuteAction()
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1024:0
#31 0x000000000283672e clang::FrontendAction::Execute()
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:897:0
#32 0x000000000280a8d6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:991:0
#33 0x00000000028cc7d1
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/su/software/tmp/polly/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#34 0x0000000000d87918 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#35 0x0000000000d15923 ExecuteCC1Tool
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:309:0
#36 0x0000000000d15923 main
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:388:0
#37 0x00007f770fc25f45 __libc_start_main
/build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0
#38 0x0000000000d83b59 _start
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xd83b59)
Stack dump:
0.      Program arguments: /home/su/software/tmp/polly/llvm_build/bin/clang-6.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
small.c -mrelocation-model static -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -resource-dir
/home/su/software/tmp/polly/llvm_build/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir
/home/su/specres/20170927-clangpolly-m64-O3-mllvm-polly-mllvm-enable-newgvn-build-083337
-ferror-limit 19 -fmessage-length 116 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-6b8006.o -x c small.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.      Running pass 'Loop Pass Manager' on function '@fn1'
5.      Running pass 'Induction Variable Simplification' on basic block
'%while.body'
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 6.0.0 (http://llvm.org/git/clang.git
31a16c4f5bc89d8e9ca6c0a52a34b98c18058b6b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
clang-6.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-6.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-6.0: note: diagnostic msg: /tmp/small-f2a065.c
clang-6.0: note: diagnostic msg: /tmp/small-f2a065.sh
clang-6.0: note: diagnostic msg: 

********************
$ 


-----------------------------------


volatile int a;
int b;

void fn1 (int *d)
{
  while (b)
    {
      b = *d;
      for (b = 0; b < 2; b++)
        if (b)
          (a, d=0);
    }
}

int main ()
{
  fn1 (&b); 
  return 0; 
}

-- 
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/20170928/41ad56c8/attachment-0001.html>


More information about the llvm-bugs mailing list