<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 crashes on valid code with __builtin_ia32_addcarryx_u64 on x86_64-linux-gnu"
   href="https://llvm.org/bugs/show_bug.cgi?id=24943">24943</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on valid code with __builtin_ia32_addcarryx_u64 on x86_64-linux-gnu
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>su@cs.ucdavis.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>The current clang trunk (as well as clang 3.6.x and 3.7.x) crashes when
compiling the following code at all optimization levels in both 32-bit and
64-bit modes on x86_64-linux-gnu.  

It is a regression from 3.5.x. 


$ clang-trunk -v
clang version 3.8.0 (trunk 248604)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.1.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.2
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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.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

$ clang-3.5 -c small.c

$ clang-trunk -c small.c
Value type is non-standard value, Other.
UNREACHABLE executed at /tmp/llvm/include/llvm/CodeGen/MachineValueType.h:387!
#0 0x2fb75e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x2fb75e8)
#1 0x2fb6386 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x2fb6386)
#2 0x2fb6596 (/usr/local/clang-trunk/bin/clang+0x2fb6596)
#3 0x7f4be1849340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7f4be07e4cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f4be07e80d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x2f9b1ec (/usr/local/clang-trunk/bin/clang+0x2f9b1ec)
#7 0x1a92ad8 (/usr/local/clang-trunk/bin/clang+0x1a92ad8)
#8 0x252c250 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc,
llvm::EVT, bool, bool) (/usr/local/clang-trunk/bin/clang+0x252c250)
#9 0x23ce7cc llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*,
llvm::TargetLowering::DAGCombinerInfo&) const
(/usr/local/clang-trunk/bin/clang+0x23ce7cc)
#10 0x24c7aff (/usr/local/clang-trunk/bin/clang+0x24c7aff)
#11 0x24c8263 (/usr/local/clang-trunk/bin/clang+0x24c8263)
#12 0x24c9202 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults&,
llvm::CodeGenOpt::Level) (/usr/local/clang-trunk/bin/clang+0x24c9202)
#13 0x2590ce7 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang+0x2590ce7)
#14 0x2599b9c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function
const&) (/usr/local/clang-trunk/bin/clang+0x2599b9c)
#15 0x259b889
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang+0x259b889)
#16 0x2359c74 (/usr/local/clang-trunk/bin/clang+0x2359c74)
#17 0x2f24e4f llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x2f24e4f)
#18 0x2f24e8b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2f24e8b)
#19 0x2f26c37 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2f26c37)
#20 0xb8c5c8 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang+0xb8c5c8)
#21 0xb697ba (/usr/local/clang-trunk/bin/clang+0xb697ba)
#22 0xdc3d02 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xdc3d02)
#23 0xb6bfa2 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang+0xb6bfa2)
#24 0x960e76 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x960e76)
#25 0x937f2e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x937f2e)
#26 0x91978c clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x91978c)
#27 0x911580 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/clang-trunk/bin/clang+0x911580)
#28 0x8f7dba main (/usr/local/clang-trunk/bin/clang+0x8f7dba)
#29 0x7f4be07cfec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#30 0x90fc0d _start (/usr/local/clang-trunk/bin/clang+0x90fc0d)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -coverage-file /home/su/20150925-clang-build-test987/small.c
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdebug-compilation-dir
/home/su/20150925-clang-build-test987 -ferror-limit 19 -fmessage-length 100
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o small.o -x
c small.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'small.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@foo'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 248604)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
clang: 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: note: diagnostic msg: 
********************

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

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



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


typedef unsigned char u8; 
typedef unsigned long long u64; 

u8 __builtin_ia32_addcarryx_u64 (u8, u64, u64, u64 *);

void foo ()
{
  __builtin_ia32_addcarryx_u64 (0, 0, 0, 0);
}</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>