[llvm-bugs] [Bug 30306] New: clang crashes on valid C++ code: Assertion `!Cleanup.exprNeedsCleanups() && "Unaccounted cleanups in function"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 7 00:38:28 PDT 2016


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

            Bug ID: 30306
           Summary: clang crashes on valid C++ code: Assertion
                    `!Cleanup.exprNeedsCleanups() && "Unaccounted cleanups
                    in function"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is a regression from 3.8.x (I didn't check 3.9.0). 


$ clang++ -v
clang version 4.0.0 (trunk 280695)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
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.4
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
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++-3.8.1 small.cpp
$ g++-6.2 small.cpp
$ 
$ clang++ small.cpp
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaDecl.cpp:11833:
clang::Decl* clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*,
bool): Assertion `!Cleanup.exprNeedsCleanups() && "Unaccounted cleanups in
function"' failed.
#0 0x0000000001e47605 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e47605)
#1 0x0000000001e456ee llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1e456ee)
#2 0x0000000001e45850 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e45850)
#3 0x00007f9cf7257330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f9cf604cc37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f9cf6050028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f9cf6045bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f9cf6045ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000002c47f3f clang::Sema::ActOnFinishFunctionBody(clang::Decl*,
clang::Stmt*, bool) (/usr/local/clang-trunk/bin/clang-4.0+0x2c47f3f)
#9 0x0000000002fe2041
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2fe2041)
#10 0x0000000002fe0997 clang::Sema::PerformPendingInstantiations(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2fe0997)
#11 0x0000000002b8f0bc clang::Sema::ActOnEndOfTranslationUnit()
(/usr/local/clang-trunk/bin/clang-4.0+0x2b8f0bc)
#12 0x0000000002980a75
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2980a75)
#13 0x0000000002977d83 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x2977d83)
#14 0x00000000025e915e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x25e915e)
#15 0x00000000022e7a7e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x22e7a7e)
#16 0x00000000022bd0d6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x22bd0d6)
#17 0x0000000002377182
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2377182)
#18 0x0000000000b564d0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb564d0)
#19 0x0000000000b00f4a main (/usr/local/clang-trunk/bin/clang-4.0+0xb00f4a)
#20 0x00007f9cf6037f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#21 0x0000000000b5262e _start (/usr/local/clang-trunk/bin/clang-4.0+0xb5262e)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-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 -fdeprecated-macro
-fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 115
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/small-f3d55c.o -x c++ small.cpp 
1.    <eof> parser at end of file
2.    small.cpp:3:30: instantiating function definition 'g<int>'
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 280695)
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-b474af.cpp
clang-4.0: note: diagnostic msg: /tmp/small-b474af.sh
clang-4.0: note: diagnostic msg: 

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


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


int f (int const & p) { return p; }

template < typename T > void g (T) { int a[f(1)]; }

int main ()
{
  g < int > (1);
  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/20160907/db71d94c/attachment.html>


More information about the llvm-bugs mailing list