[LLVMbugs] [Bug 9973] New: Assertion getValueKind() == VK_LValue in reduced boost testcase

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 20 13:56:04 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9973

           Summary: Assertion getValueKind() == VK_LValue in reduced boost
                    testcase
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The code below crashes clang, with the backtrace show. While this code is
invalid, it is derived from a boost test case, so it would be nice to fix it.


template<class R, class T> struct dm
{
  typedef R T::*F;
  F f_;
  template<class U> int & call(U u)
  { return u->*f_; }

  template<class U> int operator()(U u)
  { call(u); }
};

template<class R, class T> 
dm<R, T> mem_fn(R T::*) ;

struct test
{ int nullary_v(); };

void f()
{
  test* t;
  mem_fn(&test::nullary_v)(t);
}


t.cc:9:14: warning: control reaches end of non-void function [-Wreturn-type]
  { call(u); }
             ^
t.cc:23:27: note: in instantiation of function template specialization 'dm<int
(), test>::operator()<test *>' requested here                                   
  mem_fn(&test::nullary_v)(t);
                          ^
clang: ExprClassification.cpp:72: Cl
clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const:
Assertion `getValueKind() == VK_LValue' failed.            
0  clang           0x0000000002649982
1  clang           0x000000000264977e
2  libpthread.so.0 0x00007f74c1612c60
3  libc.so.6       0x00007f74c08fdd05 gsignal + 53
4  libc.so.6       0x00007f74c0901ab6 abort + 390
5  libc.so.6       0x00007f74c08f67c5 __assert_fail + 245
6  clang           0x00000000019e651a
clang::Expr::ClassifyImpl(clang::ASTContext&, clang::SourceLocation*) const +
404
7  clang           0x0000000001378064 clang::Expr::Classify(clang::ASTContext&)
const + 40
8  clang           0x0000000001637bbc
9  clang           0x000000000163992a
clang::InitializationSequence::InitializationSequence(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
clang::Expr**, unsigned int) + 694
10 clang           0x000000000163f558
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&,
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>) + 282
11 clang           0x00000000016870d1
clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&,
clang::VarDecl const*, clang::QualType, clang::Expr*) + 891
12 clang           0x0000000001687cf2
clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*) + 1748
13 clang           0x00000000017413d8
14 clang           0x0000000001734ba8
15 clang           0x000000000172b404
16 clang           0x0000000001740e20
17 clang           0x0000000001733068
18 clang           0x000000000172b154
19 clang           0x0000000001727b4d clang::Sema::SubstStmt(clang::Stmt*,
clang::MultiLevelTemplateArgumentList const&) + 121
20 clang           0x0000000001754b8d
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2033
21 clang           0x0000000001756f38
clang::Sema::PerformPendingInstantiations(bool) + 334
22 clang           0x0000000001754cb0
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool) + 2324
23 clang           0x0000000001756f38
clang::Sema::PerformPendingInstantiations(bool) + 334
24 clang           0x00000000014e442f clang::Sema::ActOnEndOfTranslationUnit()
+ 381
25 clang           0x00000000014a403e
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 178
26 clang           0x000000000148505c clang::ParseAST(clang::Sema&, bool) + 416
27 clang           0x00000000011f119f clang::ASTFrontendAction::ExecuteAction()
+ 263
28 clang           0x0000000001325a7b clang::CodeGenAction::ExecuteAction() +
927
29 clang           0x00000000011f0dfb clang::FrontendAction::Execute() + 325
30 clang           0x00000000011d7feb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 741
31 clang           0x000000000117ee13
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 909
32 clang           0x000000000117034a cc1_main(char const**, char const**, char
const*, void*) + 952
33 clang           0x000000000117a5a3 main + 496
34 libc.so.6       0x00007f74c08e8eff __libc_start_main + 255
35 clang           0x000000000116fa19
Stack dump:
0.      Program arguments: /llvmdebug/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
t.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.21.51.20110409 -momit-leaf-frame-pointer -coverage-file t.o -resource-dir
/llvmdebug/bin/../lib/clang/3.0 -fdeprecated-macro -ferror-limit 19
-fmessage-length 173 -fcxx-exceptions -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o t.o -x c++ t.cc 
1.      <eof> parser at end of file
2.      t.cc:8:25: instantiating function definition 'operator()'
3.      t.cc:5:27: instantiating function definition 'call'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list