[llvm-bugs] [Bug 36121] New: clang crashes at -O3: Running pass 'Combine pattern based expressions'

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 27 15:46:06 PST 2018


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

            Bug ID: 36121
           Summary: clang crashes at -O3: Running pass 'Combine pattern
                    based expressions'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 7.0.0 (trunk 323585)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


$ clang-trunk -O3 abc.c
abc.c:11:23: warning: unsequenced modification and access to 'e'
[-Wunsequenced]
      if (e >= (a = e |= d))
          ~           ^
abc.c:12:9: warning: expression result unused [-Wunused-value]
        b;
        ^
#0 0x00000000021a184a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x21a184a)
#1 0x000000000219f6ee llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x219f6ee)
#2 0x000000000219f842 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x219f842)
#3 0x00007f3bea136330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x0000000001ce1b30 llvm::Type::getScalarSizeInBits() const
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x1ce1b30)
#5 0x0000000003c82640 llvm::TruncInstCombine::getBestTruncatedType()
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x3c82640)
#6 0x0000000003c827c8 llvm::TruncInstCombine::run(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x3c827c8)
#7 0x0000000003c7cd5b (anonymous
namespace)::AggressiveInstCombinerLegacyPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x3c7cd5b)
#8 0x0000000001cb4a83 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x1cb4a83)
#9 0x000000000172764e (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x172764e)
#10 0x0000000001cb461d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x1cb461d)
#11 0x000000000235e891 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x235e891)
#12 0x00000000023601d0 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> >)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x23601d0)
#13 0x0000000002bb5df7
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x2bb5df7)
#14 0x0000000002d98218 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x2d98218)
#15 0x0000000002bb51ac clang::CodeGenAction::ExecuteAction()
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x2bb51ac)
#16 0x000000000273312e clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x273312e)
#17 0x0000000002701526
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x2701526)
#18 0x00000000027c738b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x27c738b)
#19 0x0000000000a74b28 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-7.0+0xa74b28)
#20 0x00000000009ec09c main
(/home/absozero/trunk/root-clang/bin/clang-7.0+0x9ec09c)
#21 0x00007f3be8c9ef45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#22 0x0000000000a70b39 _start
(/home/absozero/trunk/root-clang/bin/clang-7.0+0xa70b39)
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-7.0 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 173 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-506d23.o -x c
abc.c
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'abc.c'.
4.      Running pass 'Combine pattern based expressions' on function '@fn1'
clang-7.0: error: unable to execute command: Segmentation fault (core dumped)
clang-7.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 323585)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7.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-7.0: note: diagnostic msg: /tmp/abc-85da36.c
clang-7.0: note: diagnostic msg: /tmp/abc-85da36.sh
clang-7.0: note: diagnostic msg:

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


$ cat abc.c
char a;
short b, c, d;
void fn1() {
l1:
  d = 2;
  for (;;) {
    short e = 12;
    if (c ? 0 : 0 >= (e = 1 == d))
      goto l1;
    {
      if (e >= (a = e |= d))
        b;
    }
  }
}
int main() {}

-- 
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/20180127/d0eb45a9/attachment-0001.html>


More information about the llvm-bugs mailing list