[LLVMbugs] [Bug 14249] New: Type-tag safety attribute checking fails when 0 is passed as a pointer
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Nov 3 07:26:08 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=14249
Bug #: 14249
Summary: Type-tag safety attribute checking fails when 0 is
passed as a pointer
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: hfinkel at anl.gov
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
The easiest way to reproduce this error is the following:
in test/Sema/warn-type-safety.c
after this:
void test_tag_mismatch(int *ptr)
{
A_func(ptr, &A_tag); // no-warning
A_func(ptr, &B_tag); // expected-warning {{this type tag was not designed to
be used with this function}}
C_func(ptr, C_tag); // no-warning
C_func(ptr, D_tag); // expected-warning {{this type tag was not designed to
be used with this function}}
C_func(ptr, 10); // no-warning
C_func(ptr, 20); // should warn, but may cause false positives
}
add this:
void test_void_void(const void *a)
{
C_func(0, C_tag);
}
and this will cause clang to assert:
clang:
/src/llvm-trunk-writable/tools/clang/lib/Frontend/../../include/clang/AST/Type.h:547:
const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const:
Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
in
11 clang 0x000000000114e160
clang::Sema::CheckArgumentWithTypeTag(clang::ArgumentWithTypeTagAttr const*,
clang::Expr const* const*) + 968
12 clang 0x00000000011382c0 clang::Sema::checkCall(clang::NamedDecl*,
clang::Expr**, unsigned int, unsigned int, bool, clang::SourceLocation,
clang::SourceRange, clang::Sema::VariadicCallType) + 462
13 clang 0x00000000011384b4
clang::Sema::CheckFunctionCall(clang::FunctionDecl*, clang::CallExpr*,
clang::FunctionProtoType const*) + 306
14 clang 0x0000000001268179
clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*,
clang::SourceLocation, clang::Expr**, unsigned int, clang::SourceLocation,
clang::Expr*, bool) + 3887
15 clang 0x0000000001384e4c
16 clang 0x000000000138555f
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation, clang::Expr**, unsigned
int, clang::SourceLocation, clang::Expr*, bool) + 417
17 clang 0x0000000001266d20 clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1976
...
1. /tmp/warn-type-safety.c:85:18: current parser token ')'
2. /tmp/warn-type-safety.c:84:1: parsing function body 'test_void_void'
3. /tmp/warn-type-safety.c:84:1: in compound statement ('{}')
clang: error: unable to execute command: Aborted (core dumped)
--
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