<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 at -O1 and above on x86_64-linux-gnu: Assertion `isSimple() && "Expected a SimpleValueType!"' failed"
   href="https://llvm.org/bugs/show_bug.cgi?id=26835">26835</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on valid code at -O1 and above on x86_64-linux-gnu: Assertion `isSimple() && "Expected a SimpleValueType!"' 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>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 crashes when compiling the following test case on
x86_64-linux-gnu at -O1 and above in both 32-bit and 64-bit modes. 

This is a regression from 3.7.x.  


$ clang-trunk -v
clang version 3.9.0 (trunk 262545)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.4
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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.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-trunk -O0 -c small.c
$ clang-3.7 -O1 -c small.c

$ clang-trunk -O1 -c small.c
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/CodeGen/ValueTypes.h:227:
llvm::MVT llvm::EVT::getSimpleVT() const: Assertion `isSimple() && "Expected a
SimpleValueType!"' failed.
#0 0x0000000001c63165 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c63165)
#1 0x0000000001c610f6 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1c610f6)
#2 0x0000000001c61314 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c61314)
#3 0x00007ff58256b340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007ff58178dcc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff5817910d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007ff581786b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007ff581786c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x000000000087b7b6 llvm::EVT::getVectorElementType() const [clone .part.129]
(/usr/local/clang-trunk/bin/clang-3.9+0x87b7b6)
#9 0x00000000021a83cc (anonymous
namespace)::DAGCombiner::useDivRem(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21a83cc)
#10 0x00000000021e1246 (anonymous
namespace)::DAGCombiner::visitREM(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21e1246)
#11 0x00000000021dde18 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21dde18)
#12 0x00000000021df1bc (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x21df1bc)
#13 0x00000000021e0a5b llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
(/usr/local/clang-trunk/bin/clang-3.9+0x21e0a5b)
#14 0x000000000229bd99 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang-3.9+0x229bd99)
#15 0x00000000022a591f
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x22a591f)
#16 0x00000000022a70d1
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x22a70d1)
#17 0x00000000012ecd14 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x12ecd14)
#18 0x00000000018f35b3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x18f35b3)
#19 0x00000000018f3bfb llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x18f3bfb)
#20 0x0000000001da2902 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-3.9+0x1da2902)
#21 0x0000000002350fe8
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2350fe8)
#22 0x000000000267e73d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x267e73d)
#23 0x00000000023510ae clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x23510ae)
#24 0x0000000002094e26 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x2094e26)
#25 0x000000000206db06
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x206db06)
#26 0x000000000211db22
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x211db22)
#27 0x0000000000ab5dc0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xab5dc0)
#28 0x0000000000a72efd main (/usr/local/clang-trunk/bin/clang-3.9+0xa72efd)
#29 0x00007ff581778ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#30 0x0000000000ab1e44 _start (/usr/local/clang-trunk/bin/clang-3.9+0xab1e44)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -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
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb
-coverage-file /home/su/20160303-clang-trunk-m64-O3-build-114341/small.c
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/home/su/20160303-clang-trunk-m64-O3-build-114341 -ferror-limit 19
-fmessage-length 114 -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 '@fn1'
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 262545)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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/small-25e85e.c
clang-3.9: note: diagnostic msg: /tmp/small-25e85e.sh
clang-3.9: note: diagnostic msg: 

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



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


struct
{
  char f0;
  unsigned f1:24;
} a;

void
fn1 ()
{
  a.f1 %= 3;
}</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>