[llvm-bugs] [Bug 27277] New: clang crashes on valid code at -O2 and above on x86_64-linux-gnu running pass 'CallGraph Pass Manager'

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 7 23:05:49 PDT 2016


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

            Bug ID: 27277
           Summary: clang crashes on valid code at -O2 and above on
                    x86_64-linux-gnu running pass 'CallGraph Pass Manager'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case at -O2
and above on x86_64-linux-gnu in 32-bit mode. The 64-bit mode works fine.

It affects all clang versions since 3.5.


$ clang-trunk -v
clang version 3.9.0 (trunk 265649)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/3.4.6
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.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.3.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64




$ clang-trunk -m32 -O2 abc.c
clang-3.9: /home/absozero/trunk/llvm/lib/Analysis/InlineCost.cpp:329: bool
(anonymous namespace)::CallAnalyzer::visitAlloca(llvm::AllocaInst &): Assertion
`AllocSize && "Allocation size not a constant int?"' failed.
#0 0x00000000019499a8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x19499a8)
#1 0x0000000001947e56 llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1947e56)
#2 0x000000000194a0be SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x194a0be)
#3 0x00007ff17a8c7340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007ff179a79cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007ff179a7d0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007ff179a72b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007ff179a72c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000022cb92f llvm::InstVisitor<(anonymous namespace)::CallAnalyzer,
bool>::visit(llvm::Instruction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x22cb92f)
#9 0x00000000022c6a8e (anonymous
namespace)::CallAnalyzer::analyzeCall(llvm::CallSite)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x22c6a8e)
#10 0x00000000022c5376 llvm::getInlineCost(llvm::CallSite, llvm::Function*,
int, llvm::TargetTransformInfo&, llvm::AssumptionCacheTracker*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x22c5376)
#11 0x00000000015fd820 llvm::Inliner::shouldInline(llvm::CallSite)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x15fd820)
#12 0x000000000160130b llvm::Inliner::runOnSCC(llvm::CallGraphSCC&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x160130b)
#13 0x00000000022bfb1c (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x22bfb1c)
#14 0x0000000001560387 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1560387)
#15 0x0000000001a98f33 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/absozero/trunk/root-clang/bin/clang-3.9+0x1a98f33)
#16 0x00000000021953ab
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x21953ab)
#17 0x0000000002548576 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x2548576)
#18 0x0000000001e52c05 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1e52c05)
#19 0x0000000001e1dd41
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1e1dd41)
#20 0x0000000001ee84d7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1ee84d7)
#21 0x0000000000746c0c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x746c0c)
#22 0x0000000000745776 main
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x745776)
#23 0x00007ff179a64ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#24 0x00000000007426c2 _start
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x7426c2)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang-3.9 -cc1
-triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-a915c0.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'.
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 265649)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: 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-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/abc-409f7e.c
clang-3.9: note: diagnostic msg: /tmp/abc-409f7e.sh
clang-3.9: note: diagnostic msg:

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



$ cat abc.c
void fn1();
void fn2(int p1) {
  double v[p1];
  fn1(v);
  int i;
  fn2(i);
}

-- 
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/20160408/e8f58fb2/attachment.html>


More information about the llvm-bugs mailing list