Skip to content
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

[static analyzer] Fix DEREF_OF_NULL.DYN_CAST on loco/IR/CanonicalNodes.lst #14569

Open
chunseoklee opened this issue Jan 21, 2025 · 4 comments
Open

Comments

@chunseoklee
Copy link
Contributor

The whole lines on are reported as DEREF_OF_NULL.DYN_CAST in static analyzer.

For example,

CANONICAL_NODE(ReLU6, ReLU6)

warning : Pointer '((struct Tanh*)return value of __dynamic_cast(...))', returned from function 'dynamic_cast' at CanonicalNodes.lst 38, may be NULL and is passed as 1st parameter in call to function '(anonymous namespace) CanonicalNodeDescBuilder visit' at CanonicalNodes.lst 38, where it is dereferenced at CanonicalNodeSummaryBuilder.cpp 244.

Let's fix it or ignore it.

@seanshpark
Copy link
Contributor

I think it's related with adding a null check in
compiler/locop/src/CanonicalNodeSummaryBuilder.cpp

std::string opname(const loco::Node *node)
{
  if (node->dialect() == loco::CanonicalDialect::get())
  {

to

std::string opname(const loco::Node *node)
{
  if (node != nullptr && node->dialect() == loco::CanonicalDialect::get())
  {

@seanshpark
Copy link
Contributor

Return value of a function 'loco::NamedEntity::name[abi:cxx11]' is dereferenced at PartitionPModules.cpp:98 without checking for NULL

I'll post a PR for this issue too

@seanshpark
Copy link
Contributor

Same error but at CanonicalTypeForwardAlgorithm::visit'

@chunseoklee
Copy link
Contributor Author

Since I do not have any good idea to resolve this in one shot, let's keep it as 'intentional'(ignored in system)

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

2 participants