Skip to content

Assertion `!isValueDependent() && "Cannot get the length of a value-dependent pack size expression"' failed #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fitzgen opened this issue Nov 18, 2016 · 2 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Nov 18, 2016

Getting this assertion failure from inside clang when I updated my bindgen for the SpiderMonkey bindings work I've been doing.

My best guess is that this is related to the macro expression parsing stuff?

cc @emilio

Here is a backtrace:

(rr) bt
#0  0x0000000070000002 in ?? ()
#1  0x00007fdcdc80dd2f in _raw_syscall () at ../src/preload/raw_syscall.S:120
#2  0x00007fdcdc80b389 in traced_raw_syscall (call=<optimized out>) at ../src/preload/preload.c:282
#3  sys_futex (call=<optimized out>) at ../src/preload/preload.c:1450
#4  syscall_hook_internal (call=0x7ffdecb72ab8) at ../src/preload/preload.c:2330
#5  0x00007fdcdc809be1 in syscall_hook (call=0x7ffdecb72ab8) at ../src/preload/preload.c:2406
#6  0x00007fdcdc80dd5a in _syscall_hook_trampoline () at ../src/preload/syscall_hook.S:170
#7  0x00007fdcdc80dd79 in _syscall_hook_trampoline_48_3d_00_f0_ff_ff () at ../src/preload/syscall_hook.S:226
#8  0x00007fdcd3b6a6fb in raise () from /lib64/libc.so.6
#9  0x00007fdcd3b6c2fa in abort () from /lib64/libc.so.6
#10 0x00007fdcd3b62f97 in __assert_fail_base () from /lib64/libc.so.6
#11 0x00007fdcd3b63042 in __assert_fail () from /lib64/libc.so.6
#12 0x00007fdcd4ba3cb6 in clang::SizeOfPackExpr::getPackLength (this=0x7fdcd1500b18)
    at /home/fitzgen/src/llvm/tools/clang/include/clang/AST/ExprCXX.h:3731
#13 0x00007fdcd4b54470 in (anonymous namespace)::IntExprEvaluator::VisitSizeOfPackExpr (this=0x7ffdecb72f00, E=0x7fdcd1500b18)
    at /home/fitzgen/src/llvm/tools/clang/lib/AST/ExprConstant.cpp:8171
#14 0x00007fdcd4b6e209 in clang::StmtVisitorBase<clang::make_const_ptr, (anonymous namespace)::IntExprEvaluator, bool>::Visit
    (this=0x7ffdecb72f00, S=0x7fdcd1500b18) at /home/fitzgen/src/llvm/obj/tools/clang/include/clang/AST/StmtNodes.inc:755
#15 0x00007fdcd4b58ff4 in Evaluate (Result=..., Info=..., E=0x7fdcd1500b18)
    at /home/fitzgen/src/llvm/tools/clang/lib/AST/ExprConstant.cpp:8996
#16 0x00007fdcd4b598c7 in EvaluateAsRValue (Info=..., E=0x7fdcd1500b18, Result=...)
    at /home/fitzgen/src/llvm/tools/clang/lib/AST/ExprConstant.cpp:9085
#17 0x00007fdcd4b59c84 in clang::Expr::EvaluateAsRValue (this=0x7fdcd1500b18, Result=..., Ctx=...)
    at /home/fitzgen/src/llvm/tools/clang/lib/AST/ExprConstant.cpp:9140
#18 0x00007fdcd4927261 in evaluateExpr (expr=0x7fdcd1500b18, C=...)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:3522
#19 0x00007fdcd4927f13 in clang_Cursor_Evaluate (C=...) at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:3666
#20 0x0000558a537dcab5 in libbindgen::clang::EvalResult::new (cursor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:1301
#21 0x0000558a537d75c0 in libbindgen::clang::Cursor::evaluate (self=0x7ffdecb74b98)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:481
#22 0x0000558a537fc808 in libbindgen::ir::var::{{impl}}::parse (cursor=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/var.rs:211
#23 0x0000558a537f0276 in libbindgen::ir::item::{{impl}}::parse (cursor=..., parent_id=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:794
#24 0x0000558a5384816c in libbindgen::ir::comp::{{impl}}::from_ty::{{closure}} (cur=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/comp.rs:730
#25 0x0000558a537d7794 in libbindgen::clang::visit_children<closure> (cur=..., _parent=..., data=0x7ffdecb776c8)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:496
#26 0x00007fdcd491a80f in clang::cxcursor::CursorVisitor::Visit (this=0x7ffdecb77510, Cursor=..., 
    CheckedRegionOfInterest=true) at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:208
#27 0x00007fdcd491c1bd in clang::cxcursor::CursorVisitor::handleDeclForVisitation (this=0x7ffdecb77510, D=0x7fdcd1500ab8)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:665
#28 0x00007fdcd491bf17 in clang::cxcursor::CursorVisitor::VisitDeclContext (this=0x7ffdecb77510, DC=0x7fdcd15006b8)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:626
#29 0x00007fdcd491c3ad in clang::cxcursor::CursorVisitor::VisitTagDecl (this=0x7ffdecb77510, D=0x7fdcd1500680)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:696
#30 0x00007fdcd4920821 in clang::cxcursor::CursorVisitor::VisitCXXRecordDecl (this=0x7ffdecb77510, D=0x7fdcd1500680)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:1734
#31 0x00007fdcd491d1bb in clang::cxcursor::CursorVisitor::VisitClassTemplateDecl (this=0x7ffdecb77510, D=0x7fdcd1500718)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:917
#32 0x00007fdcd4950fff in clang::declvisitor::Base<clang::declvisitor::make_ptr, clang::cxcursor::CursorVisitor, bool>::Visit
    (this=0x7ffdecb77510, D=0x7fdcd1500718) at /home/fitzgen/src/llvm/obj/tools/clang/include/clang/AST/DeclNodes.inc:189
#33 0x00007fdcd491b6c4 in clang::cxcursor::CursorVisitor::VisitChildren (this=0x7ffdecb77510, Cursor=...)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:497
#34 0x00007fdcd4929612 in clang_visitChildren (parent=..., 
    visitor=0x558a537d75e0 <libbindgen::clang::visit_children<closure>>, client_data=0x7ffdecb776c8)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:4040
#35 0x0000558a537d6518 in libbindgen::clang::Cursor::visit<closure> (self=0x7ffdecb77e78, visitor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:314
#36 0x0000558a537dfce8 in libbindgen::ir::comp::CompInfo::from_ty (potential_id=..., ty=0x7ffdecb7c478, location=..., 
    ctx=0x7ffdecb82d58) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/comp.rs:519
#37 0x0000558a537f82c8 in libbindgen::ir::ty::Type::from_clang_ty (potential_id=..., ty=0x7ffdecb7c478, location=..., 
    parent_id=..., ctx=0x7ffdecb82d58) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/ty.rs:616
#38 0x0000558a537f2e3b in libbindgen::ir::item::{{impl}}::from_ty_with_id (id=..., ty=0x7ffdecb7c478, location=..., 
    parent_id=..., ctx=0x7ffdecb82d58) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:977
#39 0x0000558a537f247f in libbindgen::ir::item::{{impl}}::from_ty (ty=0x7ffdecb7c478, location=..., parent_id=..., 
    ctx=0x7ffdecb82d58) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:910
#40 0x0000558a537f07c7 in libbindgen::ir::item::{{impl}}::parse (cursor=..., parent_id=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:800
#41 0x0000558a5380070e in libbindgen::parse_one (ctx=0x7ffdecb82d58, cursor=..., parent=..., children=0x7ffdecb7dfb8)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:555
#42 0x0000558a538492d5 in libbindgen::ir::module::{{impl}}::parse::{{closure}}::{{closure}} (cursor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:52
#43 0x0000558a537d8b84 in libbindgen::clang::visit_children<closure> (cur=..., _parent=..., data=0x7ffdecb7de18)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:496
#44 0x00007fdcd491a80f in clang::cxcursor::CursorVisitor::Visit (this=0x7ffdecb7dc70, Cursor=..., 
    CheckedRegionOfInterest=true) at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:208
#45 0x00007fdcd491c1bd in clang::cxcursor::CursorVisitor::handleDeclForVisitation (this=0x7ffdecb7dc70, D=0x7fdcd1500718)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:665
#46 0x00007fdcd491bf17 in clang::cxcursor::CursorVisitor::VisitDeclContext (this=0x7ffdecb7dc70, DC=0x7fdcd14eee50)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:626
#47 0x00007fdcd491e377 in clang::cxcursor::CursorVisitor::VisitNamespaceDecl (this=0x7ffdecb7dc70, D=0x7fdcd14eee28)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:1187
#48 0x00007fdcd4950ef7 in clang::declvisitor::Base<clang::declvisitor::make_ptr, clang::cxcursor::CursorVisitor, bool>::Visit
    (this=0x7ffdecb7dc70, D=0x7fdcd14eee28) at /home/fitzgen/src/llvm/obj/tools/clang/include/clang/AST/DeclNodes.inc:99
#49 0x00007fdcd491b6c4 in clang::cxcursor::CursorVisitor::VisitChildren (this=0x7ffdecb7dc70, Cursor=...)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:497
#50 0x00007fdcd4929612 in clang_visitChildren (parent=..., 
    visitor=0x558a537d89d0 <libbindgen::clang::visit_children<closure>>, client_data=0x7ffdecb7de18)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:4040
#51 0x0000558a537d66b2 in libbindgen::clang::Cursor::visit<closure> (self=0x7ffdecb7e158, visitor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:314
#52 0x0000558a5384b19c in libbindgen::ir::module::{{impl}}::parse::{{closure}} (ctx=0x7ffdecb82d58, children=0x7ffdecb7dfb8)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:51
#53 0x0000558a537e946a in libbindgen::ir::context::BindgenContext::with_module<closure> (self=0x7ffdecb82d58, module_id=..., 
    cb=...) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/context.rs:907
#54 0x0000558a537f54b0 in libbindgen::ir::module::{{impl}}::parse (cursor=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:50
#55 0x0000558a537ef9fe in libbindgen::ir::item::{{impl}}::parse (cursor=..., parent_id=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:784
#56 0x0000558a5380070e in libbindgen::parse_one (ctx=0x7ffdecb82d58, cursor=..., parent=..., children=0x7ffdecb80158)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:555
#57 0x0000558a538492d5 in libbindgen::ir::module::{{impl}}::parse::{{closure}}::{{closure}} (cursor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:52
#58 0x0000558a537d8b84 in libbindgen::clang::visit_children<closure> (cur=..., _parent=..., data=0x7ffdecb7ffb8)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:496
#59 0x00007fdcd491a80f in clang::cxcursor::CursorVisitor::Visit (this=0x7ffdecb7fe10, Cursor=..., 
    CheckedRegionOfInterest=true) at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:208
#60 0x00007fdcd491c1bd in clang::cxcursor::CursorVisitor::handleDeclForVisitation (this=0x7ffdecb7fe10, D=0x7fdcd14eee28)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:665
#61 0x00007fdcd491bf17 in clang::cxcursor::CursorVisitor::VisitDeclContext (this=0x7ffdecb7fe10, DC=0x7fdcd14eea58)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:626
#62 0x00007fdcd491e377 in clang::cxcursor::CursorVisitor::VisitNamespaceDecl (this=0x7ffdecb7fe10, D=0x7fdcd14eea30)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:1187
#63 0x00007fdcd4950ef7 in clang::declvisitor::Base<clang::declvisitor::make_ptr, clang::cxcursor::CursorVisitor, bool>::Visit
    (this=0x7ffdecb7fe10, D=0x7fdcd14eea30) at /home/fitzgen/src/llvm/obj/tools/clang/include/clang/AST/DeclNodes.inc:99
#64 0x00007fdcd491b6c4 in clang::cxcursor::CursorVisitor::VisitChildren (this=0x7ffdecb7fe10, Cursor=...)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:497
#65 0x00007fdcd4929612 in clang_visitChildren (parent=..., 
    visitor=0x558a537d89d0 <libbindgen::clang::visit_children<closure>>, client_data=0x7ffdecb7ffb8)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:4040
#66 0x0000558a537d66b2 in libbindgen::clang::Cursor::visit<closure> (self=0x7ffdecb802f8, visitor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:314
#67 0x0000558a5384b19c in libbindgen::ir::module::{{impl}}::parse::{{closure}} (ctx=0x7ffdecb82d58, children=0x7ffdecb80158)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:51
#68 0x0000558a537e946a in libbindgen::ir::context::BindgenContext::with_module<closure> (self=0x7ffdecb82d58, module_id=..., 
    cb=...) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/context.rs:907
#69 0x0000558a537f54b0 in libbindgen::ir::module::{{impl}}::parse (cursor=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/module.rs:50
#70 0x0000558a537ef9fe in libbindgen::ir::item::{{impl}}::parse (cursor=..., parent_id=..., ctx=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/item.rs:784
#71 0x0000558a5380070e in libbindgen::parse_one (ctx=0x7ffdecb82d58, cursor=..., parent=..., children=0x7ffdecb822a0)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:555
#72 0x0000558a53849728 in libbindgen::parse::{{closure}}::{{closure}} (cursor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:583
#73 0x0000558a537d8f24 in libbindgen::clang::visit_children<closure> (cur=..., _parent=..., data=0x7ffdecb82108)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:496
#74 0x00007fdcd491a80f in clang::cxcursor::CursorVisitor::Visit (this=0x7ffdecb81f60, Cursor=..., 
    CheckedRegionOfInterest=true) at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:208
#75 0x00007fdcd491c1bd in clang::cxcursor::CursorVisitor::handleDeclForVisitation (this=0x7ffdecb81f60, D=0x7fdcd14eea30)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:665
#76 0x00007fdcd491bf17 in clang::cxcursor::CursorVisitor::VisitDeclContext (this=0x7ffdecb81f60, DC=0x7fdcd2a9d2f0)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:626
#77 0x00007fdcd491b976 in clang::cxcursor::CursorVisitor::VisitChildren (this=0x7ffdecb81f60, Cursor=...)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:531
#78 0x00007fdcd4929612 in clang_visitChildren (parent=..., 
    visitor=0x558a537d8d70 <libbindgen::clang::visit_children<closure>>, client_data=0x7ffdecb82108)
    at /home/fitzgen/src/llvm/tools/clang/tools/libclang/CIndex.cpp:4040
#79 0x0000558a537d6a39 in libbindgen::clang::Cursor::visit<closure> (self=0x7ffdecb82470, visitor=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/clang.rs:314
#80 0x0000558a5384b211 in libbindgen::parse::{{closure}} (context=0x7ffdecb82d58, children=0x7ffdecb822a0)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:583
#81 0x0000558a537e974e in libbindgen::ir::context::BindgenContext::with_module<closure> (self=0x7ffdecb82d58, module_id=..., 
    cb=...) at /home/fitzgen/src/rust-bindgen/libbindgen/src/ir/context.rs:907
#82 0x0000558a53800b5e in libbindgen::parse (context=0x7ffdecb82d58)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:582
#83 0x0000558a537fed61 in libbindgen::Bindings::generate (options=..., span=...)
    at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:449
#84 0x0000558a537fe5b6 in libbindgen::Builder::generate (self=...) at /home/fitzgen/src/rust-bindgen/libbindgen/src/lib.rs:285
#85 0x0000558a536aed31 in bindgen::main () at /home/fitzgen/src/rust-bindgen/src/main.rs:72
#86 0x0000558a53fcaee7 in __rust_maybe_catch_panic ()
#87 0x0000558a53fc1bc2 in std::rt::lang_start::h14cbded5fe3cd915 ()
#88 0x0000558a536b0f34 in main ()
@fitzgen
Copy link
Member Author

fitzgen commented Nov 18, 2016

Unclear to me whether this is a bug in clang or our usage of libclang.

@fitzgen
Copy link
Member Author

fitzgen commented Nov 18, 2016

Ok, took creduce a little longer than usual, but here is a reduced test case:

template <typename... T>
struct B {
    static const long c = sizeof...(T);
};

Although we can't make proper Rust bindings to variadic templates, we definitely shouldn't be triggering assertions in libclang and dumping core.

fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Nov 19, 2016
This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes rust-lang#283
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Nov 19, 2016
This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes rust-lang#283
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Nov 19, 2016
This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes rust-lang#283
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Nov 19, 2016
This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes rust-lang#283
bors-servo pushed a commit that referenced this issue Nov 21, 2016
Do not evaluate variadic template types

This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes #283

r? @emilio
luser pushed a commit to luser/rust-bindgen that referenced this issue Mar 27, 2017
Switch Travis support to a proper build matrix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant