<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 --- - crash on valid C code at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu ()"
   href="https://llvm.org/bugs/show_bug.cgi?id=31262">31262</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash on valid C code at -O1 and above in both 32-bit and 64-bit modes 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>Windows NT
          </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>chengniansun@gmail.com
          </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>$ clang-trunk -v
clang version 4.0.0 (trunk 288620)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.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.2
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
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.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ clang-trunk -O1 small.c
#0 0x0000000001d27065 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d27065)
#1 0x0000000001d2503e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d2503e)
#2 0x0000000001d251a2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d251a2)
#3 0x00007feae0534330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x000000000190f40e llvm::ConstantExpr::isGEPWithNoNotionalOverIndexing()
const (/usr/local/clang-trunk/bin/clang-4.0+0x190f40e)
#5 0x000000000190196a evaluateICmpRelation(llvm::Constant*, llvm::Constant*,
bool) (/usr/local/clang-trunk/bin/clang-4.0+0x190196a)
#6 0x0000000001901d9b llvm::ConstantFoldCompareInstruction(unsigned short,
llvm::Constant*, llvm::Constant*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1901d9b)
#7 0x0000000001921a19 llvm::ConstantExpr::getICmp(unsigned short,
llvm::Constant*, llvm::Constant*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1921a19)
#8 0x000000000154c299 SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, (anonymous namespace)::Query const&, unsigned int)
(/usr/local/clang-trunk/bin/clang-4.0+0x154c299)
#9 0x000000000154e424 llvm::SimplifyICmpInst(unsigned int, llvm::Value*,
llvm::Value*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*,
llvm::DominatorTree const*, llvm::AssumptionCache*, llvm::Instruction const*)
(/usr/local/clang-trunk/bin/clang-4.0+0x154e424)
#10 0x000000000154f2bd llvm::SimplifyInstruction(llvm::Instruction*,
llvm::DataLayout const&, llvm::TargetLibraryInfo const*, llvm::DominatorTree
const*, llvm::AssumptionCache*)
(/usr/local/clang-trunk/bin/clang-4.0+0x154f2bd)
#11 0x0000000001b9afd0 (anonymous namespace)::EarlyCSE::run()
(/usr/local/clang-trunk/bin/clang-4.0+0x1b9afd0)
#12 0x0000000001b9d56b (anonymous
namespace)::EarlyCSELegacyCommonPass<false>::runOnFunction(llvm::Function&)
[clone .part.383] (/usr/local/clang-trunk/bin/clang-4.0+0x1b9d56b)
#13 0x0000000001992e83 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1992e83)
#14 0x0000000001992ff7
llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1992ff7)
#15 0x000000000199346c llvm::legacy::FunctionPassManager::run(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x199346c)
#16 0x0000000001e967b6 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e967b6)
#17 0x0000000001e98645 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
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> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e98645)
#18 0x00000000024be1cb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x24be1cb)
#19 0x00000000028b3212 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x28b3212)
#20 0x00000000024b94de clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x24b94de)
#21 0x00000000021c8cc6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x21c8cc6)
#22 0x00000000021a2d66
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x21a2d66)
#23 0x0000000002251c7a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2251c7a)
#24 0x0000000000ac28c8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xac28c8)
#25 0x0000000000a64881 main (/usr/local/clang-trunk/bin/clang-4.0+0xa64881)
#26 0x00007feadf310f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000abe8ce _start (/usr/local/clang-trunk/bin/clang-4.0+0xabe8ce)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.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
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.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/cnsun/ramdisk/reduction/20161203-clang-trunk-m64-Weverything-g-O3-build-215525/delta
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-e34e02.o -x c
small.c 
1.      <eof> parser at end of file
2.      Per-function optimization
3.      Running pass 'Early CSE' on function '@main'
clang-4.0: error: unable to execute command: Segmentation fault (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 288620)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-cea0ae.c
clang-4.0: note: diagnostic msg: /tmp/small-cea0ae.sh
clang-4.0: note: diagnostic msg: 

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

$ cat small.c
int a[1];
int main () {
  long b;
  return &a[b] >= a;
}
$</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>