[LLVMbugs] [Bug 12145] New: codegen assert: Should not use decl without marking it used!
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Feb 29 17:02:19 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12145
Bug #: 12145
Summary: codegen assert: Should not use decl without marking it
used!
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
sharparrow1 at yahoo.com
Classification: Unclassified
The following code causes clang to assert in codegen:
int a[20]; constexpr int *p = &a[5]; int n = *p;
clang-3.0: src/tools/clang/lib/CodeGen/CGExpr.cpp:1376: clang::CodeGen::LValue
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr *):
Assertion `(ND->isUsed(false) || !isa<VarDecl>(ND) ||
!E->getLocation().isValid()) && "Should not use decl without marking it used!"'
failed.
As far as I can see (please correct me if I'm wrong), we're right to not mark p
as used: it is usable in a constant expression and the lvalue-to-rvalue
conversion is immediately applied. Presumably codegen is simply not trying to
emit the value directly.
--
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