[LLVMbugs] [Bug 18217] New: clang asserts in skipRValueSubobjectAdjustments

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 11 15:06:00 PST 2013


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

            Bug ID: 18217
           Summary: clang asserts in skipRValueSubobjectAdjustments
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ganna at apple.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code triggers an assertion in clang TOT. The assertion is coming
from the jump diagnostic code; switch is necessary for reproduction.

$ cat ex.cpp
class X {
};

template <typename T>
class MyCl {
  T mem;
};

class Source {
  MyCl<X> m;
public:
  int getKind() const;
};

bool b;
template<typename TT>
static void foo(const Source &SF, MyCl<TT *> Source::*m) {
  switch (SF.getKind()) {
    case 1: return;
    case 2: break;
    case 3:
    case 4: return;
  };
  if (b) {
    auto &y = const_cast<MyCl<TT *> &>(SF.*m);
  }
}

int main(int argc, char **argv) {
}

$ clang -std=c++11 ex.cpp
Assertion failed: (BO->getRHS()->isRValue()), function
skipRValueSubobjectAdjustments, file
/Volumes/Data/ws/llvmgit/llvm/tools/clang/lib/AST/Expr.cpp, line 89.
0  clang                    0x000000010b34193e
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang                    0x000000010b341c4b
PrintStackTraceSignalHandler(void*) + 27
2  clang                    0x000000010b341fdc SignalHandler(int) + 412
3  libsystem_platform.dylib 0x00007fff8a7b55aa _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff560c3578 _sigtramp + 3415269352
5  clang                    0x000000010b341c7b raise + 27
6  clang                    0x000000010b341d32 abort + 18
7  clang                    0x000000010b341d11 __assert_rtn + 129
8  clang                    0x000000010cd0da60
clang::Expr::skipRValueSubobjectAdjustments(llvm::SmallVectorImpl<clang::Expr
const*>&, llvm::SmallVectorImpl<clang::SubobjectAdjustment>&) const + 752
9  clang                    0x000000010c49d6e0
GetDiagForGotoScopeDecl(clang::ASTContext&, clang::Decl const*) + 1200
10 clang                    0x000000010c49cd5e (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Decl*, unsigned
int&) + 62
11 clang                    0x000000010c49ad23 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 1731
12 clang                    0x000000010c49b335 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 3285
13 clang                    0x000000010c49b335 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 3285
14 clang                    0x000000010c49a54e (anonymous
namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) +
222
15 clang                    0x000000010c49a295 (anonymous
namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) + 37
16 clang                    0x000000010c49a238
clang::Sema::DiagnoseInvalidJumps(clang::Stmt*) + 56

-- 
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/20131211/fe959e26/attachment.html>


More information about the llvm-bugs mailing list