[llvm-bugs] [Bug 44619] New: SEGV on erroneous input

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 22 03:07:10 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=44619

            Bug ID: 44619
           Summary: SEGV on erroneous input
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jan.kratochvil at redhat.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

It prints an error but then it crashes.
I cannot provide a preprocessed source as -E does not produce anything.
If I remove compilation error the crash no longer happens.
Tested on updated Fedora 30 x86_64.

clang++ -c -o /dev/null -D'throw(...)=noexcept(false)'
/usr/include/glibmm-2.4/glibmm/variant.h -I/usr/include/glibmm-2.4 -isystem
/usr/include -std=c++17

clang-10: warning: treating 'c-header' input as 'c++-header' when in C++ mode,
this behavior is deprecated [-Wdeprecated]
/usr/include/glibmm-2.4/glibmm/variant.h:23:10: fatal error: 'glibmmconfig.h'
file not found
#include <glibmmconfig.h>
         ^~~~~~~~~~~~~~~~
clang++:
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/SourceManager.cpp:840:
clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const:
Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
Stack dump:
0.      Program arguments:
/home/jkratoch/redhat/llvm-monorepo-gccassertdebug/bin/clang++ -c -o /dev/null
-Dthrow(...)=noexcept(false) /usr/include/glibmm-2.4/glibmm/variant.h
-I/usr/include/glibmm-2.4 -isystem /usr/include -std=c++17 
1.     
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_map.h:1427:8:
at annotation token
2.     
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ostream:41:1:
parsing namespace 'std'
3.     
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_map.h:66:1:
parsing namespace 'std::std'
 #0 0x0000000004952f6e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/Unix/Signals.inc:564:22
 #1 0x0000000004953001 PrintStackTraceSignalHandler(void*)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/Unix/Signals.inc:625:1
 #2 0x00000000049510a6 llvm::sys::RunSignalHandlers()
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/Signals.cpp:68:20
 #3 0x00000000049528a7 llvm::sys::CleanupOnSignal(unsigned long)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/Unix/Signals.inc:361:31
 #4 0x000000000486e332 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/CrashRecoveryContext.cpp:80:5
 #5 0x000000000486e77b CrashRecoverySignalHandler(int)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/CrashRecoveryContext.cpp:362:1
 #6 0x00007fa5300dac70 __restore_rt (/lib64/libpthread.so.0+0x12c70)
 #7 0x00007fa52e217e35 raise
/usr/src/debug/glibc-2.29-51-g845278f2c6/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #8 0x00007fa52e202895 abort
/usr/src/debug/glibc-2.29-51-g845278f2c6/stdlib/abort.c:81:7
 #9 0x00007fa52e202769 _nl_load_domain.cold
/usr/src/debug/glibc-2.29-51-g845278f2c6/intl/loadmsgcat.c:1177:9
#10 0x00007fa52e210566 (/lib64/libc.so.6+0x30566)
#11 0x0000000004b75aa9 clang::SourceManager::getFileIDLoaded(unsigned int)
const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/SourceManager.cpp:849:7
#12 0x0000000004b757aa clang::SourceManager::getFileIDSlow(unsigned int) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/SourceManager.cpp:740:1
#13 0x0000000004b63f6c clang::SourceManager::getFileID(clang::SourceLocation)
const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/SourceManager.h:1098:3
#14 0x0000000004b64019
clang::SourceManager::getDecomposedLoc(clang::SourceLocation) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/SourceManager.h:1239:31
#15 0x0000000004b5f1f0
clang::DiagnosticsEngine::DiagStateMap::lookup(clang::SourceManager&,
clang::SourceLocation) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/Diagnostic.cpp:202:67
#16 0x0000000004b6e490
clang::DiagnosticsEngine::GetDiagStateForLoc(clang::SourceLocation) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/Diagnostic.h:414:56
#17 0x0000000004b6d379 clang::DiagnosticIDs::getDiagnosticSeverity(unsigned
int, clang::SourceLocation, clang::DiagnosticsEngine const&) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/DiagnosticIDs.cpp:428:64
#18 0x0000000004b6d311 clang::DiagnosticIDs::getDiagnosticLevel(unsigned int,
clang::SourceLocation, clang::DiagnosticsEngine const&) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/DiagnosticIDs.cpp:409:17
#19 0x0000000004b6dd56
clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/DiagnosticIDs.cpp:637:25
#20 0x0000000004b6369e clang::DiagnosticsEngine::ProcessDiag()
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/Diagnostic.h:980:3
#21 0x0000000004b607cf clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Basic/Diagnostic.cpp:517:26
#22 0x00000000021e2330 clang::DiagnosticBuilder::Emit()
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/Diagnostic.h:1112:49
#23 0x00000000021e235e clang::DiagnosticBuilder::~DiagnosticBuilder()
/quad/home/jkratoch/redhat/llvm-monorepo/clang/include/clang/Basic/Diagnostic.h:1136:3
#24 0x0000000007078e00 clang::Parser::ParseUnqualifiedId(clang::CXXScopeSpec&,
bool, bool, bool, bool, clang::OpaquePtr<clang::QualType>,
clang::SourceLocation*, clang::UnqualifiedId&)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseExprCXX.cpp:2819:28
#25 0x000000000702ca7b clang::Parser::ParseDirectDeclarator(clang::Declarator&)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:5859:29
#26 0x000000000702bccd
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:5611:5
#27 0x000000000702b4c6 clang::Parser::ParseDeclarator(clang::Declarator&)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:5479:1
#28 0x000000000701f5ec clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:2012:17
#29 0x0000000007002af8
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) /quad/home/jkratoch/r
edhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:1100:1
#30 0x0000000007002bb2
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) /quad/home/jkra
toch/redhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:1115:57
#31 0x0000000007002095
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:935:58
#32 0x000000000703d240
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDeclCXX.cpp:244:50
#33 0x000000000703d071 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDeclCXX.cpp:227:22
#34 0x000000000701ec51
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:1771:43
#35 0x0000000007001c55
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:868:77
#36 0x000000000703d240
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDeclCXX.cpp:244:50
#37 0x000000000703d071 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDeclCXX.cpp:227:22
#38 0x000000000701ec51
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&,
clang::SourceLocation*)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseDecl.cpp:1771:43
#39 0x0000000007001c55
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (.localalias)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:868:77
#40 0x0000000007001124
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/Parser.cpp:686:42
#41 0x0000000006ffcf1d clang::ParseAST(clang::Sema&, bool, bool)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Parse/ParseAST.cpp:158:37
#42 0x00000000053a3059 clang::ASTFrontendAction::ExecuteAction()
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Frontend/FrontendAction.cpp:1043:11
#43 0x00000000053a29c5 clang::FrontendAction::Execute()
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Frontend/FrontendAction.cpp:940:38
#44 0x000000000533b87d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Frontend/CompilerInstance.cpp:965:42
#45 0x00000000054fcb18
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:38
#46 0x00000000021e9a9a cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/tools/driver/cc1_main.cpp:239:40
#47 0x00000000021df9f3 ExecuteCC1Tool(llvm::ArrayRef<char const*>)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/tools/driver/driver.cpp:325:64
#48 0x000000000524abae
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()::operator()() const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Driver/Job.cpp:402:32
#49 0x000000000524b2cd void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long)
/home/jkratoch/redhat/llvm-monorepo/llvm/include/llvm/ADT/STLExtras.h:109:40
#50 0x000000000486ed02 llvm::function_ref<void ()>::operator()() const
/home/jkratoch/redhat/llvm-monorepo/llvm/include/llvm/ADT/STLExtras.h:125:62
#51 0x000000000486e920
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
/home/jkratoch/redhat/llvm-monorepo/llvm/lib/Support/CrashRecoveryContext.cpp:397:10
#52 0x000000000524ad50
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Driver/Job.cpp:402:7
#53 0x00000000052066da
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Driver/Compilation.cpp:182:22
#54 0x00000000052069eb
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Driver/Compilation.cpp:233:53
#55 0x0000000005215013
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
/quad/home/jkratoch/redhat/llvm-monorepo/clang/lib/Driver/Driver.cpp:1480:28
#56 0x00000000021e085b main
/quad/home/jkratoch/redhat/llvm-monorepo/clang/tools/driver/driver.cpp:492:39
#57 0x00007fa52e203f43 __libc_start_main
/usr/src/debug/glibc-2.29-51-g845278f2c6/csu/../csu/libc-start.c:342:3
#58 0x00000000021de36e _start
(/home/jkratoch/redhat/llvm-monorepo-gccassertdebug/bin/clang+++0x21de36e)
clang-10: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (https://jankratochvil:github.com/llvm/llvm-project.git
b4a5d076e4ef514b8e6c55b747e272997b7438b9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jkratoch/redhat/llvm-monorepo-gccassertdebug/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-10: note: diagnostic msg: Error generating preprocessed source(s).

-- 
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/20200122/65acd76f/attachment-0001.html>


More information about the llvm-bugs mailing list