[llvm-bugs] [Bug 25542] New: Crash when deleting a member with an initialiser of a class template

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 16 10:03:16 PST 2015


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

            Bug ID: 25542
           Summary: Crash when deleting a member with an initialiser of a
                    class template
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: davorin.ucakar at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Clang crashes when compiling:

template <class T>
struct Resource
{
  T handle = T();
};

int main()
{
  Resource<int*>* resources;
  delete resources[0].handle;
  return 0;
}

Output:

$ clang++ -std=c++11 scratch.cc
0  libLLVM.so.3.7  0x00007f251a4c5228
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  libLLVM.so.3.7  0x00007f251a4c4041
2  libpthread.so.0 0x00007f2519d56d60
3  clang-3.7       0x00000000013855b8 clang::Expr::IgnoreParens() + 8
4  clang-3.7       0x000000000138630d clang::Expr::IgnoreParenImpCasts() + 13
5  clang-3.7       0x0000000000deb52f
6  clang-3.7       0x0000000000e01dd4
7  clang-3.7       0x0000000000e052a8
clang::Sema::ActOnCXXDelete(clang::SourceLocation, bool, bool, clang::Expr*) +
280
8  clang-3.7       0x0000000000aff96a
clang::Parser::ParseCXXDeleteExpression(bool, clang::SourceLocation) + 138
9  clang-3.7       0x0000000000af30da clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 3706
10 clang-3.7       0x0000000000af537d clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 45
11 clang-3.7       0x0000000000af540f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 31
12 clang-3.7       0x0000000000af5489
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
13 clang-3.7       0x0000000000b31d36 clang::Parser::ParseExprStatement() + 70
14 clang-3.7       0x0000000000b30f9f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3183
15 clang-3.7       0x0000000000b3113b
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 139
16 clang-3.7       0x0000000000b353ce
clang::Parser::ParseCompoundStatementBody(bool) + 1758
17 clang-3.7       0x0000000000b379e6
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 198
18 clang-3.7       0x0000000000abf922
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1218
19 clang-3.7       0x0000000000ad7d83
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2979
20 clang-3.7       0x0000000000abc042
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 290
21 clang-3.7       0x0000000000abc6a9
22 clang-3.7       0x0000000000abc6df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
23 clang-3.7       0x0000000000ac1fdf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 287
24 clang-3.7       0x0000000000ac2969
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 441
25 clang-3.7       0x0000000000ab6fa3 clang::ParseAST(clang::Sema&, bool, bool)
+ 499
26 clang-3.7       0x0000000000908b06 clang::FrontendAction::Execute() + 502
27 clang-3.7       0x00000000008e2e79
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 313
28 clang-3.7       0x0000000000982624
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1940
29 clang-3.7       0x0000000000652958 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2280
30 clang-3.7       0x000000000064db7b main + 1003
31 libc.so.6       0x00007f251942a610 __libc_start_main + 240
32 clang-3.7       0x0000000000650839 _start + 41
Stack dump:
0.    Program arguments: /usr/bin/clang-3.7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name scratch.cc -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 -resource-dir /usr/bin/../lib/clang/3.7.0 -internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0/../../../../include/c++/5.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.7.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /home/davorin/Razvoj/openzone/src/tests -ferror-limit
19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o /tmp/scratch-b22c40.o -x c++
scratch.cc 
1.    scratch.cc:10:29: current parser token ';'
2.    scratch.cc:8:1: parsing function body 'main'
3.    scratch.cc:8:1: in compound statement ('{}')
clang-3.7: error: unable to execute command: Segmentation fault (core dumped)
clang-3.7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
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/20151116/d83c3ca4/attachment.html>


More information about the llvm-bugs mailing list