<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang crashes at -O2 and above: : Assertion `!hasVectorValue(Key, Part) && "Vector value already set for part"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=35773">35773</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes at -O2 and above: : Assertion `!hasVectorValue(Key, Part) && "Vector value already set for part"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>helloqirun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang-trunk -v
clang version 6.0.0 (trunk 321550)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


$ clang-trunk -O2 abc.c
abc.c:6:19: warning: unsequenced modification and access to 'c' [-Wunsequenced]
    (b += c) > (c += 9);
          ~       ^
abc.c:6:14: warning: relational comparison result unused [-Wunused-comparison]
    (b += c) > (c += 9);
    ~~~~~~~~~^~~~~~~~~~
clang-6.0: /home/absozero/trunk/llvm/lib/Transforms/Vectorize/VPlan.h:167: void
llvm::VectorizerValueMap::setVectorValue(llvm::Value*, unsigned int,
llvm::Value*): Assertion `!hasVectorValue(Key, Part) && "Vector value already
set for part"' failed.
#0 0x000000000216e94a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x216e94a)
#1 0x000000000216c7ee llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x216c7ee)
#2 0x000000000216c942 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x216c942)
#3 0x00007f31803c9330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f317ef46c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f317ef4a028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f317ef3fbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f317ef3fca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000228ba0d llvm::VectorizerValueMap::setVectorValue(llvm::Value*,
unsigned int, llvm::Value*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x228ba0d)
#9 0x00000000022af04e
llvm::InnerLoopVectorizer::recordVectorLoopValueForInductionCast(llvm::InductionDescriptor
const&, llvm::Value*, unsigned int, unsigned int)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22af04e)
#10 0x00000000022af2cc
llvm::InnerLoopVectorizer::createVectorIntOrFpInductionPHI(llvm::InductionDescriptor
const&, llvm::Value*, llvm::Instruction*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22af2cc)
#11 0x00000000022affff
llvm::InnerLoopVectorizer::widenIntOrFpInduction(llvm::PHINode*,
llvm::TruncInst*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x22affff)
#12 0x00000000022df2a2 llvm::VPBasicBlock::execute(llvm::VPTransformState*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22df2a2)
#13 0x00000000022e072d llvm::VPlan::execute(llvm::VPTransformState*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22e072d)
#14 0x000000000229fe3e
llvm::LoopVectorizationPlanner::executePlan(llvm::InnerLoopVectorizer&,
llvm::DominatorTree*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0x229fe3e)
#15 0x00000000022acb3e llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22acb3e)
#16 0x00000000022ad927 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22ad927)
#17 0x00000000022adfad (anonymous
namespace)::LoopVectorize::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x22adfad)
#18 0x0000000001c851c3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c851c3)
#19 0x0000000001c8528c llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c8528c)
#20 0x0000000001c84d5d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x1c84d5d)
#21 0x000000000232c2ae 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/absozero/trunk/root-clang/bin/clang-6.0+0x232c2ae)
#22 0x0000000002b6c017
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2b6c017)
#23 0x0000000002d4d3b8 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2d4d3b8)
#24 0x0000000002b6b3cc clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2b6b3cc)
#25 0x00000000026ef54e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x26ef54e)
#26 0x00000000026bd876
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x26bd876)
#27 0x0000000002782f73
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x2782f73)
#28 0x0000000000a66db8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-6.0+0xa66db8)
#29 0x00000000009dfb5e main
(/home/absozero/trunk/root-clang/bin/clang-6.0+0x9dfb5e)
#30 0x00007f317ef31f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#31 0x0000000000a630f9 _start
(/home/absozero/trunk/root-clang/bin/clang-6.0+0xa630f9)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-6.0 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.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/absozero/trunk/root-clang/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/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/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-07e12d.o -x c
abc.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'Function Pass Manager' on module 'abc.c'.
4.      Running pass 'Loop Vectorization' on function '@fn1'
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 (trunk 321550)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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/abc-b76eb3.c
clang-6.0: note: diagnostic msg: /tmp/abc-b76eb3.sh
clang-6.0: note: diagnostic msg:

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


$ cat abc.c
unsigned a;
char b;
void fn1() {
  unsigned char c;
  for (; a; a++)
    (b += c) > (c += 9);
}
int main() {}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>