[llvm-bugs] [Bug 33406] New: clang crashes on valid code at -O1 and above running pass 'Early CSE w/ MemorySSA' (with "-mllvm -enable-earlycse-memssa")

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 11 11:53:13 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33406

            Bug ID: 33406
           Summary: clang crashes on valid code at -O1 and above running
                    pass 'Early CSE w/ MemorySSA' (with "-mllvm
                    -enable-earlycse-memssa")
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

$ clang -v
clang version 5.0.0 (trunk 305160)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.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.4
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.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.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang -O0 small.c
$ 
$ clang -O1 -mllvm -enable-earlycse-memssa small.c
#0 0x0000000002100dca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2100dca)
#1 0x00000000020feb3e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x20feb3e)
#2 0x00000000020fecb2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x20fecb2)
#3 0x00007f7297054390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x0000000002b5d087
llvm::MemorySSAUpdater::removeMemoryAccess(llvm::MemoryAccess*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2b5d087)
#5 0x0000000001ee90dc (anonymous
namespace)::EarlyCSE::removeMSSA(llvm::Instruction*)
(/usr/local/clang-trunk/bin/clang-5.0+0x1ee90dc)
#6 0x0000000001eed97e (anonymous
namespace)::EarlyCSE::processNode(llvm::DomTreeNodeBase<llvm::BasicBlock>*)
(/usr/local/clang-trunk/bin/clang-5.0+0x1eed97e)
#7 0x0000000001eee244 (anonymous namespace)::EarlyCSE::run() [clone
.constprop.357] (/usr/local/clang-trunk/bin/clang-5.0+0x1eee244)
#8 0x0000000001eef2de (anonymous
namespace)::EarlyCSELegacyCommonPass<true>::runOnFunction(llvm::Function&)
[clone .part.346] [clone .constprop.348]
(/usr/local/clang-trunk/bin/clang-5.0+0x1eef2de)
#9 0x0000000001c550a3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1c550a3)
#10 0x0000000002b15ade (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2b15ade)
#11 0x0000000001c54c0d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1c54c0d)
#12 0x00000000022b3f39 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, 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-5.0+0x22b3f39)
#13 0x00000000029a56b9
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x29a56b9)
#14 0x0000000002d72a78 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2d72a78)
#15 0x00000000029a4a4f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x29a4a4f)
#16 0x000000000265bf7e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x265bf7e)
#17 0x000000000262b576
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x262b576)
#18 0x00000000026ead4a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x26ead4a)
#19 0x0000000000b6b0d8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xb6b0d8)
#20 0x0000000000afcbb3 main (/usr/local/clang-trunk/bin/clang-5.0+0xafcbb3)
#21 0x00007f7295db2830 __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#22 0x0000000000b67789 _start (/usr/local/clang-trunk/bin/clang-5.0+0xb67789)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.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/lib/clang/5.0.0 -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/lib/clang/5.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/su -ferror-limit 19 -fmessage-length 140
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -mllvm
-enable-earlycse-memssa -o /tmp/small-5defe8.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 'Early CSE w/ MemorySSA' on function '@fn3'
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 305160)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.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-5.0: note: diagnostic msg: /tmp/small-d7b358.c
clang-5.0: note: diagnostic msg: /tmp/small-d7b358.sh
clang-5.0: note: diagnostic msg: 

********************
$ 


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


int a, b, c, d;

void fn1 () {}

int fn2 (int g)
{
  return g;
}

void fn3 ()
{
  for (; d; d++)
    {
      if (c)
        continue;
      b |= fn2 (0);
      if (a)
        fn1 ();
    }
}

int main ()
{
  fn3 ();
  return 0; 
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170611/d547ec50/attachment.html>


More information about the llvm-bugs mailing list