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

Crash clang-tidy on include map #27672

Closed
JVApen opened this issue Apr 8, 2016 · 6 comments
Closed

Crash clang-tidy on include map #27672

JVApen opened this issue Apr 8, 2016 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang-tidy

Comments

@JVApen
Copy link

JVApen commented Apr 8, 2016

Bugzilla Link 27298
Resolution FIXED
Resolved on Apr 12, 2016 17:00
Version unspecified
OS Linux

Extended Description

Clang tidy crashes on a cpp-file which only contains #include <map> (reduced from larger code)
Replacing the code by the preprocessed code makes this crash go away.

Command: clang-tidy -checks=* -extra-arg="-D__clang_tidy__" "t.cpp"

Clang-tidy has been build on revision 265835, system is an Ubuntu 14.04 64bit

@JVApen
Copy link
Author

JVApen commented Apr 8, 2016

assigned to @mgehre

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 11, 2016

More information is needed.

  1. Stack trace, please. Better if you run the assertions-enabled clang-tidy
  2. Please figure out which check does that.
  3. How does your compilation database (compile_commands.json, I guess) look like? Can you reproduce the issue using fixed compilation database (clang-tidy file.cpp -- )?
  4. Does this happen without the -extra-arg="-D__clang_tidy__"?

@JVApen
Copy link
Author

JVApen commented Apr 11, 2016

@JVApen
Copy link
Author

JVApen commented Apr 11, 2016

  1. See attachment
  2. I've tried, though as I use -check=*,-dontwant1,-dontwant2..., it's not that easy, though it should at least be in the commits of the last few weeks (2 or 3), as I try keeping up with the trunk.
  3. I'll add it too in attachment
  4. Yes it does, the -extra-arg is only to workaround other clang-tidy bugs.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 11, 2016

  1. See attachment
    1 [details]. I've tried, though as I use -check=*,-dontwant1,-dontwant2...,
    it's not that easy, though it should at least be in the commits of the last
    few weeks (2 or 3), as I try keeping up with the trunk.
  2. I'll add it too in attachment
    3 [details]. Yes it does, the -extra-arg is only to workaround other
    clang-tidy bugs.

Thanks, I was able to reproduce this:

$ cat /tmp/q.cc
#include
$ clang-tidy -checks=-*,misc-misplaced-widening-cast /tmp/q.cc -- -std=c++11
PC: @ 0x7fad758a5720 (unknown) clang::ast_type_traits::ASTNodeKind::getFromNode()
@ 0x7fad75e052d7 928 FailureSignalHandler()
@ 0x7fad738193d0 1504 __restore_rt
@ 0x7fad74f5c083 32 clang::ast_matchers::internal::DynTypedMatcher::matchesNoKindCheck()
...

The problem is in the recently added hasReturnValue matcher:

AST_MATCHER_P(ReturnStmt, hasReturnValue, internal::Matcher,
InnerMatcher) {
return InnerMatcher.matches(*Node.getRetValue(), Finder, Builder);
}

It dereferences Node.getRetValue() which can be null. The fix should be committed soon: http://reviews.llvm.org/D18991

@mgehre
Copy link
Contributor

mgehre commented Apr 13, 2016

The mentioned fix is committed in http://reviews.llvm.org/rL266043

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy
Projects
None yet
Development

No branches or pull requests

3 participants