<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 while trying to unroll loop"
   href="https://llvm.org/bugs/show_bug.cgi?id=27891">27891</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash while trying to unroll loop
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>regehr@cs.utah.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>regehr@higgs:~/test/reduce_crash_462091$ clang -v
clang version 3.9.0 (trunk 270842)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/regehr/llvm-install/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.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.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
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
regehr@higgs:~/test/reduce_crash_462091$ cat small.c
int fn2(void);

int a;
void fn1(void) {
  int b = 1;
  int *c = 0;
  for (; b; b = b - 1) {
    int **d = &c;
    c <= fn1 || fn2();
    *d = &a;
  }
}
regehr@higgs:~/test/reduce_crash_462091$ clang small.c -c -Os
small.c:9:7: warning: comparison of distinct pointer types ('int *' and 'void
(*)(void)') [-Wcompare-distinct-pointer-types]
    c <= fn1 || fn2();
    ~ ^  ~~~
clang-3.9: ../include/llvm/Support/Casting.h:237: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = llvm::ConstantInt, Y = llvm::Constant]:
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
#0 0x00000000010c0e48 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/regehr/llvm-install/bin/clang-3.9+0x10c0e48)
#1 0x00000000010c1577 SignalHandler(int)
(/home/regehr/llvm-install/bin/clang-3.9+0x10c1577)
#2 0x00007fe269ca0340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007fe268eb9c49 gsignal
/build/eglibc-IRFzFh/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007fe268ebd058 abort
/build/eglibc-IRFzFh/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007fe268eb2c06 __assert_fail_base
/build/eglibc-IRFzFh/eglibc-2.19/assert/assert.c:92:0
#6 0x00007fe268eb2cb2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fcb2)
#7 0x0000000000fd9244 tryToUnrollLoop(llvm::Loop*, llvm::DominatorTree&,
llvm::LoopInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const&,
llvm::AssumptionCache&, bool, llvm::Optional<unsigned int>,
llvm::Optional<unsigned int>, llvm::Optional<bool>, llvm::Optional<bool>)
(/home/regehr/llvm-install/bin/clang-3.9+0xfd9244)
#8 0x0000000000fd5443 (anonymous namespace)::LoopUnroll::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (/home/regehr/llvm-install/bin/clang-3.9+0xfd5443)
#9 0x0000000001af84ae llvm::LPPassManager::runOnFunction(llvm::Function&)
(/home/regehr/llvm-install/bin/clang-3.9+0x1af84ae)
#10 0x0000000000cd9e24 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/regehr/llvm-install/bin/clang-3.9+0xcd9e24)
#11 0x0000000001ad7047 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/regehr/llvm-install/bin/clang-3.9+0x1ad7047)
#12 0x0000000000cda535 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/regehr/llvm-install/bin/clang-3.9+0xcda535)
#13 0x0000000001230663 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/home/regehr/llvm-install/bin/clang-3.9+0x1230663)
#14 0x000000000197953d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/regehr/llvm-install/bin/clang-3.9+0x197953d)
#15 0x0000000001d918d6 clang::ParseAST(clang::Sema&, bool, bool)
(/home/regehr/llvm-install/bin/clang-3.9+0x1d918d6)
#16 0x0000000001617b55 clang::FrontendAction::Execute()
(/home/regehr/llvm-install/bin/clang-3.9+0x1617b55)
#17 0x00000000015de281
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/regehr/llvm-install/bin/clang-3.9+0x15de281)
#18 0x00000000016b3617
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/regehr/llvm-install/bin/clang-3.9+0x16b3617)
#19 0x00000000006a30cc cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/regehr/llvm-install/bin/clang-3.9+0x6a30cc)
#20 0x00000000006a1d3d main (/home/regehr/llvm-install/bin/clang-3.9+0x6a1d3d)
#21 0x00007fe268ea4f45 __libc_start_main
/build/eglibc-IRFzFh/eglibc-2.19/csu/libc-start.c:321:0
#22 0x000000000069eb32 _start
(/home/regehr/llvm-install/bin/clang-3.9+0x69eb32)
Stack dump:
0.    Program arguments: /home/regehr/llvm-install/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/regehr/test/reduce_crash_462091/small.c -resource-dir
/home/regehr/llvm-install/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/regehr/llvm-install/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 -Os
-fdebug-compilation-dir /home/regehr/test/reduce_crash_462091 -ferror-limit 19
-fmessage-length 146 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Loop Pass Manager' on function '@fn1'
5.    Running pass 'Unroll loops' on basic block '%for.body'
clang-3.9: error: unable to execute command: Aborted
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 270842)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/regehr/llvm-install/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-81aa9c.c
clang-3.9: note: diagnostic msg: /tmp/small-81aa9c.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>