[llvm-bugs] [Bug 28848] New: clang crashes on valid code at -Os and above on x86_64-linux-gnu (in pass 'CallGraph Pass Manager')

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 4 13:16:20 PDT 2016


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

            Bug ID: 28848
           Summary: clang crashes on valid code at -Os and above on
                    x86_64-linux-gnu (in pass 'CallGraph Pass Manager')
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is a regression from 3.8.x. 


$ clang -v
clang version 4.0.0 (trunk 277628)
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/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
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.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.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/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.3.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.1.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -O1 -c small.c
$ clang-3.8 -Os -c small.c
$
$ clang -Os -c small.c
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/Support/Casting.h:251:
typename std::enable_if<(! llvm::is_simple_type<Y>::value), typename
llvm::cast_retty<X, const Y>::ret_type>::type llvm::cast_or_null(const Y&)
[with X = llvm::Instruction; Y = llvm::WeakVH; typename std::enable_if<(!
llvm::is_simple_type<Y>::value), typename llvm::cast_retty<X, const
Y>::ret_type>::type = llvm::Instruction*]: Assertion `isa<X>(Val) &&
"cast_or_null<Ty>() argument of incompatible type!"' failed.
#0 0x0000000001db90a5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1db90a5)
#1 0x0000000001db715e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1db715e)
#2 0x0000000001db72c0 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1db72c0)
#3 0x00007f6d58b71340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f6d57962cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f6d579660d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f6d5795bb86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f6d5795bc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000001ddd037 llvm::CloneAndPruneIntoFromInst(llvm::Function*,
llvm::Function const*, llvm::Instruction const*, llvm::ValueMap<llvm::Value
const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*,
llvm::sys::SmartMutex<false> > >&, bool,
llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*)
(/usr/local/clang-trunk/bin/clang-4.0+0x1ddd037)
#9 0x0000000001df912b llvm::InlineFunction(llvm::CallSite,
llvm::InlineFunctionInfo&, llvm::AAResults*, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x1df912b)
#10 0x0000000001aa39b3 InlineCallIfPossible(llvm::CallSite,
llvm::InlineFunctionInfo&, llvm::DenseMap<llvm::ArrayType*,
std::vector<llvm::AllocaInst*, std::allocator<llvm::AllocaInst*> >,
llvm::DenseMapInfo<llvm::ArrayType*>,
llvm::detail::DenseMapPair<llvm::ArrayType*, std::vector<llvm::AllocaInst*,
std::allocator<llvm::AllocaInst*> > > >&, int, bool,
std::function<llvm::AAResults& (llvm::Function&)>&,
llvm::ImportedFunctionsInliningStatistics&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1aa39b3)
#11 0x0000000001aa5e2c llvm::Inliner::inlineCalls(llvm::CallGraphSCC&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1aa5e2c)
#12 0x000000000264f9d2 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x264f9d2)
#13 0x0000000001a16e98 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1a16e98)
#14 0x0000000001f2319a clang::EmitBackendOutput(clang::DiagnosticsEngine&,
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-4.0+0x1f2319a)
#15 0x000000000254086e
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x254086e)
#16 0x00000000028a864d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x28a864d)
#17 0x0000000002540bee clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x2540bee)
#18 0x000000000225022e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x225022e)
#19 0x0000000002226056
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2226056)
#20 0x00000000022dd1e2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x22dd1e2)
#21 0x0000000000b2bce0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb2bce0)
#22 0x0000000000ad8a02 main (/usr/local/clang-trunk/bin/clang-4.0+0xad8a02)
#23 0x00007f6d5794dec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#24 0x0000000000b27ccd _start (/usr/local/clang-trunk/bin/clang-4.0+0xb27ccd)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.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
-coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Os -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 133 -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'.
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 277628)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-df2f4b.c
clang-4.0: note: diagnostic msg: /tmp/small-df2f4b.sh
clang-4.0: note: diagnostic msg:

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


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


short a, c;

void fn1 (int p1, int p2)
{ 
  short b;
  b = a ? p2 % a : p2;
  c = p1 | b;
}

void fn2 ()
{ 
  fn1 (0, 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/20160804/d9dd9cb6/attachment.html>


More information about the llvm-bugs mailing list