[PATCH] D59934: Compare SourceLocations from different TUs by FileID
Endre Fülöp via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 31 03:47:20 PDT 2019
gamesh411 added a comment.
In D59934#1449109 <https://reviews.llvm.org/D59934#1449109>, @Szelethus wrote:
> I would still like to learn more about this issue. I am somewhat afraid that the our macro expansion is faulty. Can you provide a stacktrace maybe?
The stack trace that belongs to the same debug session I mentioned before:
#0 __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fdcf2121801 in __GI_abort () at abort.c:79
#2 0x00007fdcf589aa40 in llvm::llvm_unreachable_internal (msg=0x7fdcf4a179e5 "Unsortable locations found",
file=0x7fdcf4a05f01 "/llvm/tools/clang/lib/Basic/SourceManager.cpp", line=2038)
at /llvm/lib/Support/ErrorHandling.cpp:221
#3 0x00007fdcf4b81115 in clang::SourceManager::isBeforeInTranslationUnit (this=0xdfefc0, LHS=..., RHS=...)
at /llvm/tools/clang/lib/Basic/SourceManager.cpp:2038
#4 0x00007fdcef3f4359 in clang::MacroDirective::findDirectiveAtLoc (this=0x1144500, L=..., SM=...)
at /llvm/tools/clang/lib/Lex/MacroInfo.cpp:207
#5 0x00007fdceb40e086 in getMacroInfoForLocation (PP=..., SM=..., II=0x1135898, Loc=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:1115
#6 0x00007fdceb40d596 in getMacroNameAndArgs (ExpanLoc=..., PP=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:980
#7 0x00007fdceb40ccf3 in getMacroNameAndPrintExpansion[abi:cxx11]((anonymous namespace)::TokenPrinter&, clang::SourceLocation, clang::Preprocessor const&, (anonymous namespace)::MacroArgMap const&, llvm::SmallPtrSet<clang::IdentifierInfo*, 8u>&) (Printer=..., MacroLoc=..., PP=..., PrevArgs=..., AlreadyProcessedTokens=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:859
#8 0x00007fdceb40cb0e in getExpandedMacro (MacroLoc=..., PP=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:845
#9 0x00007fdceb40b202 in (anonymous namespace)::PlistPrinter::ReportMacroExpansions (this=0x7ffe244b7ed0,
o=..., indent=4)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:344
#10 0x00007fdceb40ab43 in printBugPath (o=..., FM=..., AnOpts=..., PP=..., Path=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:479
#11 0x00007fdceb409764 in (anonymous namespace)::PlistDiagnostics::FlushDiagnosticsImpl (this=0xe0c610,
Diags=std::vector of length 1, capacity 1 = {...}, filesMade=0x7ffe244b8898)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:583
#12 0x00007fdceb3fc9d9 in clang::ento::PathDiagnosticConsumer::FlushDiagnostics (this=0xe0c610,
Files=0x7ffe244b8898)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp:483
#13 0x00007fdceb25aae9 in clang::ento::AnalysisManager::FlushDiagnostics (this=0xe14c20)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:59
#14 0x00007fdceb25a98c in clang::ento::AnalysisManager::~AnalysisManager (this=0xe14c20)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:47
#15 0x00007fdceb25ab3c in clang::ento::AnalysisManager::~AnalysisManager (this=0xe14c20)
at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:46
#16 0x00007fdcec72dc9f in std::default_delete<clang::ento::AnalysisManager>::operator() (this=0xe13a48,
__ptr=0xe14c20)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:78
#17 0x00007fdcec72eb3c in std::unique_ptr<clang::ento::AnalysisManager, std::default_delete<clang::ento::AnalysisManager> >::reset (this=0xe13a48, __p=0xe14c20)
at /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:376
#18 0x00007fdcec6c4079 in (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit (this=0xe138b0, C=...)
at /llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:602
#19 0x00007fdceec204b6 in clang::ParseAST (S=..., PrintStats=false, SkipFunctionBodies=false)
at /llvm/tools/clang/lib/Parse/ParseAST.cpp:169
#20 0x00007fdcf37b0eb2 in clang::ASTFrontendAction::ExecuteAction (this=0xdeb800)
at /llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1035
#21 0x00007fdcf37b08e3 in clang::FrontendAction::Execute (this=0xdeb800)
at /llvm/tools/clang/lib/Frontend/FrontendAction.cpp:934
#22 0x00007fdcf372a2ba in clang::CompilerInstance::ExecuteAction (this=0xde68f0, Act=...)
at /llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:949
#23 0x00007fdcf33b14bb in clang::ExecuteCompilerInvocation (Clang=0xde68f0)
at /llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:271
#24 0x000000000023f7b4 in cc1_main (Argv=...,
Argv0=0x7ffe244bc18a "/clang-build-debug/bin/clang-9",
MainAddr=0x2320f0 <GetExecutablePath[abi:cxx11](char const*, bool)>)
at /llvm/tools/clang/tools/driver/cc1_main.cpp:218
#25 0x000000000023349f in ExecuteCC1Tool (argv=..., Tool=...)
at /llvm/tools/clang/tools/driver/driver.cpp:309
#26 0x0000000000232864 in main (argc_=339, argv_=0x7ffe244bb0e8)
at /llvm/tools/clang/tools/driver/driver.cpp:381
I can also confirm that this only comes up when I run the analysis in `CTU` mode AND with `expand-macros=true`.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59934/new/
https://reviews.llvm.org/D59934
More information about the cfe-commits
mailing list