[llvm-bugs] [Bug 49707] New: -Wdocumentation causes sporadic crash in clang::ASTContext::getRawCommentForDeclNoCacheImpl
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 23 18:47:52 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49707
Bug ID: 49707
Summary: -Wdocumentation causes sporadic crash in
clang::ASTContext::getRawCommentForDeclNoCacheImpl
Product: new-bugs
Version: 11.0
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: sean at rogue-research.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
We have a source file that reliably, but not always, causes clang 11.0.0 to
crash if and only if -Wdocumentation is used.
The .sh and .m file that the crash generates to *not* reproduce the issue, at
least not readily. Perhaps with ASan or similar it might. They are attached
regardless.
The only special thing about the source file (we think) is that it #includes
another source file.
We made a little shell script (runner.sh) that runs multiple clang processes.
On some Macs it crashes quite easily, on others even running overnight it does
not. We did not try other OSes.
We've also observed that after leaving it running for a little while, then
pressing Ctrl-C to cancel, clang will also crash, with seemingly the same
backtrace!
This crash also happens with AppleClang from Xcode 12 onwards, but not earlier.
So it's probably a regression, though we did not regress it against open
source clang.
See the attached archive for the reproducer shell script, there's also a Read
Me inside. Hopefully you can repro.
The backtrace from clang 11.0.0 [1] is:
0 clang 0x000000010b4c4465
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 clang 0x000000010b4c33f8 llvm::sys::RunSignalHandlers() +
248
2 clang 0x000000010b4c3a30
llvm::sys::CleanupOnSignal(unsigned long) + 208
3 clang 0x000000010b41505d CrashRecoverySignalHandler(int)
+ 189
4 libsystem_platform.dylib 0x00007fff700f25fd _sigtramp + 29
5 libsystem_platform.dylib 0x00007fdfb4858e00 _sigtramp + 18446743937419208736
6 clang 0x000000010d511b11
clang::ASTContext::getRawCommentForDeclNoCacheImpl(clang::Decl const*,
clang::SourceLocation, std::__1::map<unsigned int, clang::RawComment*,
std::__1::less<unsigned int>, std::__1::allocator<std::__1::pair<unsigned int
const, clang::RawComment*> > > const&) const + 513
7 clang 0x000000010d51261a
clang::ASTContext::attachCommentsToJustParsedDecls(llvm::ArrayRef<clang::Decl*>,
clang::Preprocessor const*) + 378
8 clang 0x000000010cead50a
clang::Sema::BuildDeclaratorGroup(llvm::MutableArrayRef<clang::Decl*>) + 986
9 clang 0x000000010cfa08b8
clang::Sema::ActOnFinishObjCImplementation(clang::Decl*,
llvm::ArrayRef<clang::Decl*>) + 328
10 clang 0x000000010cc6178c
clang::Parser::ParseObjCAtImplementationDeclaration(clang::SourceLocation,
clang::ParsedAttributes&) + 2828
11 clang 0x000000010ccb44ac
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 540
12 clang 0x000000010ccb3050
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
+ 1408
13 clang 0x000000010cc00bad clang::ParseAST(clang::Sema&,
bool, bool) + 509
14 clang 0x000000010bcde8da clang::FrontendAction::Execute()
+ 90
15 clang 0x000000010bc66fa1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 2097
16 clang 0x000000010bd4f50a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1962
17 clang 0x000000010989f123 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 2131
18 clang 0x000000010989d23c
ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 316
19 clang 0x000000010baf2557 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const::$_1>(long) + 23
20 clang 0x000000010b414e12
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 226
21 clang 0x000000010baf1915
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >*, bool*) const + 341
22 clang 0x000000010bac186b
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const + 411
23 clang 0x000000010bac1d8c
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&)
const + 124
24 clang 0x000000010bada64c
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) +
396
25 clang 0x000000010989cbf8 main + 10264
[1] specifically:
https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210324/456490a9/attachment.html>
More information about the llvm-bugs
mailing list