https://bugs.llvm.org/show_bug.cgi?id=46353
Bug ID: 46353
Summary: nullPointerConstant AST matcher triggers
assert(!isNull()) in QualType::getCommonPtr
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: release blocker
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: luka...@chromium.org
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
REPRO STEPS:
1. Augment TEST(NullPointerConstants, Basic) in
clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp with the following
test code:
2612 const char kTest[] = R"(
2613 template <typename T>
2614 struct MyTemplate {
2615 MyTemplate() : field_(__null) {}
2616 T* field_;
2617 };
2618 )";
2619 EXPECT_TRUE(matches(kTest, expr(nullPointerConstant())));
2. Build the unit tests:
$ cd ~/src/llvm-project/build
$ ninja tools/clang/unittests/ASTMatchers/ASTMatchersTests
3. Run the unit tests:
$ python3.7 ~/src/llvm-project/build/bin/llvm-lit -sv --param USE_Z3_SOLVER=0
~/src/llvm-project/build/tools/clang/test --filter=.*NullPointerConstants.*
EXPECTED BEHAVIOR:
1) no asserts or crashes
2) the |__null| expression is matched
ACTUAL BEHAVIOR: assert:
ASTMatchersTests:
/usr/local/google/home/lukasza/src/llvm-project/clang/include/clang/AST/Type.h:671:
const clang::ExtQualsTypeCommonBase* clang::QualType::getCommonPtr() const:
Assertion `!isNull() && "Cannot retrieve a NULL type pointer"' failed.
(I am sorry, but I don't know how to symbolize the callstack...)
NOTES:
*) The original repro used |NULL| rather than |__null|. I've used |__null|
above, to avoid having to include <stddef.h> (which is rather difficult in unit
tests, which expect self-contained inputs).
*) It seems that recently there were some changes in the AST Matchers library
that have been highlighted in the release notes:
https://clang.llvm.org/docs/ReleaseNotes.html#ast-matchers
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs