<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 --- - Compiler crash in "Induction Variable Simplification" for "-fno-exceptions""
   href="https://llvm.org/bugs/show_bug.cgi?id=27945">27945</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler crash in "Induction Variable Simplification" for "-fno-exceptions"
          </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>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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>michael@sloede.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>Created <span class=""><a href="attachment.cgi?id=16442" name="attach_16442" title="Stack trace, run script, preprocessed source">attachment 16442</a> <a href="attachment.cgi?id=16442&action=edit" title="Stack trace, run script, preprocessed source">[details]</a></span>
Stack trace, run script, preprocessed source

Given certain optimization flags, clang crashes in "Induction Variable
Simplification" during compilation. This behavior was observed both with
r270962 and r271230, but not with r253770. The bug can be triggered/prevented
reproducibly by adding/omitting the "-fno-exceptions" flag. Here is the full
stacktrace:

AILED: /pds/opt/llvm-20160530-r271230/bin/clang++    -O3 -DNDEBUG -mtune=native
-fvectorize -fslp-vectorize -DUSE_RESTRICT -DCOMPILER_ATTRIBUTES
-DDISABLE_FV_MG -fstrict-aliasing -fslp-vectorize-aggressive -fno-rtti
-fno-exceptions -fomit-frame-pointer -march=native -mtune=native -std=c++14
-stdlib=libc++ -Wall -Wextra -pedantic -Wshadow -Wfloat-equal -Wcast-align
-Wfloat-equal -Wdisabled-optimization -Wformat=2 -Winvalid-pch -Winit-self
-Wmissing-include-dirs -Wredundant-decls -Wpacked -Wpointer-arith
-Wstack-protector -Wswitch-default -Wwrite-strings -Wno-type-safety -Werror
-Wunused -Wno-infinite-recursion -Wno-undefined-var-template -Isrc -isystem
/pds/opt/fftw/include -isystem /pds/opt/parallel-netcdf-1.7.0/include -isystem
/pds/opt/openmpi/include -MMD -MT src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o
-MF src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o.d -o
src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o -c src/zfsfvmbblock3d.cpp
clang-3.9:
/pds/opt/install/llvm/llvm-20160530-r271230-src/lib/Transforms/Scalar/IndVarSimplify.cpp:2105:
bool (anonymous namespace)::IndVarSimplify::run(llvm::Loop *): Assertion
`L->isRecursivelyLCSSAForm(*DT) && "LCSSA required to run indvars!"' failed.
#0 0x0000000001a48248 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1a48248)
#1 0x0000000001a48977 SignalHandler(int)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1a48977)
#2 0x00007f3ea3c6f870 __restore_rt (/lib64/libpthread.so.0+0xf870)
#3 0x00007f3ea2eb00a7 __GI_raise (/lib64/libc.so.6+0x350a7)
#4 0x00007f3ea2eb1458 __GI_abort (/lib64/libc.so.6+0x36458)
#5 0x00007f3ea2ea9126 __assert_fail_base (/lib64/libc.so.6+0x2e126)
#6 0x00007f3ea2ea91d2 (/lib64/libc.so.6+0x2e1d2)
#7 0x00000000018d65f8 (anonymous namespace)::IndVarSimplify::run(llvm::Loop*)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x18d65f8)
#8 0x00000000018cf698 (anonymous
namespace)::IndVarSimplifyLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) (/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x18cf698)
#9 0x000000000242383e llvm::LPPassManager::runOnFunction(llvm::Function&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x242383e)
#10 0x00000000016474e4 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x16474e4)
#11 0x0000000002402588 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x2402588)
#12 0x0000000001647bf5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1647bf5)
#13 0x0000000001ba9353 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1ba9353)
#14 0x00000000022d5a8d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x22d5a8d)
#15 0x00000000026ab6a6 clang::ParseAST(clang::Sema&, bool, bool)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x26ab6a6)
#16 0x0000000001f777c5 clang::FrontendAction::Execute()
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1f777c5)
#17 0x0000000001f3ece1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x1f3ece1)
#18 0x000000000200d645
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x200d645)
#19 0x00000000007839d7 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x7839d7)
#20 0x000000000078247d main
(/aia/opt/llvm-20160530-r271230/bin/clang-3.9+0x78247d)
#21 0x00007f3ea2e9cb05 __libc_start_main (/lib64/libc.so.6+0x21b05)
#22 0x000000000077f282 _start
/home/abuild/rpmbuild/BUILD/glibc-2.19/csu/../sysdeps/x86_64/start.S:125:0
Stack dump:
0.    Program arguments: /aia/opt/llvm-20160530-r271230/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
zfsfvmbblock3d.cpp -mrelocation-model static -mthread-model posix -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu penryn -target-feature +sse2 -target-feature +cx16 -target-feature
-tbm -target-feature -avx512ifma -target-feature -avx512dq -target-feature
-fma4 -target-feature -prfchw -target-feature -bmi2 -target-feature -xsavec
-target-feature -fsgsbase -target-feature -popcnt -target-feature -aes
-target-feature -pcommit -target-feature -xsaves -target-feature -avx512er
-target-feature -clwb -target-feature -avx512f -target-feature -pku
-target-feature -smap -target-feature +mmx -target-feature -xop -target-feature
-rdseed -target-feature -hle -target-feature -sse4a -target-feature -avx512bw
-target-feature -clflushopt -target-feature -xsave -target-feature -avx512vl
-target-feature -invpcid -target-feature -avx512cd -target-feature -avx
-target-feature -rtm -target-feature -fma -target-feature -bmi -target-feature
-mwaitx -target-feature -rdrnd -target-feature +sse4.1 -target-feature -sse4.2
-target-feature -avx2 -target-feature +sse -target-feature -lzcnt
-target-feature -pclmul -target-feature -prefetchwt1 -target-feature -f16c
-target-feature +ssse3 -target-feature -sgx -target-feature +cmov
-target-feature -avx512vbmi -target-feature -movbe -target-feature -xsaveopt
-target-feature -sha -target-feature -adx -target-feature -avx512pf
-target-feature +sse3 -momit-leaf-frame-pointer -dwarf-column-info
-debugger-tuning=gdb -coverage-file
/home/mic/Code/ZFS/toolchain_update/src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o
-resource-dir /aia/opt/llvm-20160530-r271230/bin/../lib/clang/3.9.0
-dependency-file src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o.d -MT
src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o -isystem /pds/opt/fftw/include
-isystem /pds/opt/parallel-netcdf-1.7.0/include -isystem
/pds/opt/openmpi/include -D NDEBUG -D USE_RESTRICT -D COMPILER_ATTRIBUTES -D
DISABLE_FV_MG -I src -internal-isystem
/aia/opt/llvm-20160530-r271230/bin/../include/c++/v1 -internal-isystem
/usr/local/include -internal-isystem
/aia/opt/llvm-20160530-r271230/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-Wall -Wextra -Wshadow -Wfloat-equal -Wcast-align -Wfloat-equal
-Wdisabled-optimization -Wformat=2 -Winvalid-pch -Winit-self
-Wmissing-include-dirs -Wredundant-decls -Wpacked -Wpointer-arith
-Wstack-protector -Wswitch-default -Wwrite-strings -Wno-type-safety -Werror
-Wunused -Wno-infinite-recursion -Wno-undefined-var-template -pedantic
-std=c++14 -fdeprecated-macro -fdebug-compilation-dir
/home/mic/Code/ZFS/toolchain_update -ferror-limit 19 -fmessage-length 0
-fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops
-vectorize-slp -vectorize-slp-aggressive -o
src/CMakeFiles/zfs.dir/zfsfvmbblock3d.cpp.o -x c++ src/zfsfvmbblock3d.cpp
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'src/zfsfvmbblock3d.cpp'.
4.    Running pass 'Loop Pass Manager' on function
'@_ZN14ZFSFvMbBlock3D19createCutFaceMb_MGCEv'
5.    Running pass 'Induction Variable Simplification' on basic block
'%for.body197'
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 271230)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /pds/opt/llvm-20160530-r271230/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/zfsfvmbblock3d-04d894.cpp
clang-3.9: note: diagnostic msg: /tmp/zfsfvmbblock3d-04d894.sh
clang-3.9: note: diagnostic msg:

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

Attached are the stack trace, the run script, and the preprocessed sources.</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>