<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 crash with KNL target, Assertion `Emitted && "Failed to emit a zext!"' failed"
   href="https://llvm.org/bugs/show_bug.cgi?id=27591">27591</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crash with KNL target, Assertion `Emitted && "Failed to emit a zext!"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anton.mitrokhin@phystech.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16289" name="attach_16289" title="Reproducer">attachment 16289</a> <a href="attachment.cgi?id=16289&action=edit" title="Reproducer">[details]</a></span>
Reproducer

You can find a small reproducer attached. The test fails with -O0 only.

Run:
<span class="quote">> clang++ -std=c++11 -O0 -march=knl -o out crash.cpp</span >

<span class="quote">> clang++ -v</span >
clang version 3.9.0 (trunk 268042)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /export/users/amitrokh/llvm/bin-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64


Output:
clang-3.9:
/export/users/amitrokh/llvm/llvm-trunk/lib/Target/X86/X86FastISel.cpp:3033:
virtual bool
{anonymous}::X86FastISel::fastLowerCall(llvm::FastISel::CallLoweringInfo&):
Assertion `Emitted && "Failed to emit a zext!"' failed.
#0 0x000000000110e885 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x110e885)
#1 0x000000000110c636 llvm::sys::RunSignalHandlers()
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x110c636)
#2 0x000000000110c861 SignalHandler(int)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x110c861)
#3 0x00007fba194c1100 __restore_rt (/lib64/libpthread.so.0+0xf100)
#4 0x00007fba186ef5f7 __GI_raise (/lib64/libc.so.6+0x355f7)
#5 0x00007fba186f0ce8 __GI_abort (/lib64/libc.so.6+0x36ce8)
#6 0x00007fba186e8566 __assert_fail_base (/lib64/libc.so.6+0x2e566)
#7 0x00007fba186e8612 (/lib64/libc.so.6+0x2e612)
#8 0x0000000000901904 (anonymous
namespace)::X86FastISel::fastLowerCall(llvm::FastISel::CallLoweringInfo&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x901904)
#9 0x00000000016dede8
llvm::FastISel::lowerCallTo(llvm::FastISel::CallLoweringInfo&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16dede8)
#10 0x00000000016dfdd9 llvm::FastISel::lowerCall(llvm::CallInst const*)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16dfdd9)
#11 0x00000000016e426d llvm::FastISel::selectCall(llvm::User const*)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16e426d)
#12 0x00000000016e0c55 llvm::FastISel::selectOperator(llvm::User const*,
unsigned int) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16e0c55)
#13 0x00000000016e64e6 llvm::FastISel::selectInstruction(llvm::Instruction
const*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x16e64e6)
#14 0x00000000017b878f
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x17b878f)
#15 0x00000000017bab84
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x17bab84)
#16 0x00000000007c01e4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x7c01e4)
#17 0x0000000000b10054
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xb10054)
#18 0x0000000000d9de43 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd9de43)
#19 0x0000000000d9e1fb llvm::FPPassManager::runOnModule(llvm::Module&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd9e1fb)
#20 0x0000000000d9e50f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0xd9e50f)
#21 0x000000000125bc72 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x125bc72)
#22 0x0000000001893efc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1893efc)
#23 0x0000000001c9218b clang::ParseAST(clang::Sema&, bool, bool)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1c9218b)
#24 0x00000000018942bb clang::CodeGenAction::ExecuteAction()
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x18942bb)
#25 0x0000000001574a76 clang::FrontendAction::Execute()
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1574a76)
#26 0x000000000155079e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x155079e)
#27 0x0000000001608b5c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x1608b5c)
#28 0x00000000006eb6c8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x6eb6c8)
#29 0x00000000006c49bf main
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x6c49bf)
#30 0x00007fba186dbb15 __libc_start_main (/lib64/libc.so.6+0x21b15)
#31 0x00000000006e7745 _start
(/export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9+0x6e7745)
Stack dump:
0.      Program arguments: /export/users/amitrokh/llvm/bin-trunk/bin/clang-3.9
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name crash.cpp -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu knl -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/export/users/amitrokh/llvm/bin-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/backward
-internal-isystem /usr/local/include -internal-isystem
/export/users/amitrokh/llvm/bin-trunk/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O0
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/export/users/amitrokh/forCreduce/untracked/new_clang_zext -ferror-limit 19
-fmessage-length 237 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/crash-3bf223.o -x c++
crash.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'crash.cpp'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function
'@_ZNSt14_Bit_referenceaSERKS_'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 268042)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /export/users/amitrokh/llvm/bin-trunk/bin
clang-3.9: 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-3.9: note: diagnostic msg:
********************

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

********************</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>