[llvm-bugs] [Bug 42402] New: segmentation fault with c++17 when including missing header then boost string

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 26 01:59:55 PDT 2019


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

            Bug ID: 42402
           Summary: segmentation fault with c++17 when including missing
                    header then boost string
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthieu.moatti at epita.fr
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Overview:

Clang++ has a segmentation fault when including a missing header and boost
string in this order with the flag -std=c++17.


Step to reproduce:

$ ls
bug.cc
$ cat bug.cc
#include "bug.hh"
#include <boost/algorithm/string.hpp>
$ clang++ -std=c++17 bug.cc
bug.cc:1:10: fatal error: 'bug.hh' file not found
#include "bug.hh"
         ^~~~~~~~
Stack dump:
0.      Program arguments: /usr/bin/clang-8 -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name bug.cc -mrelocation-model pic -pic-level 2 -pic-is-pie
-mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/lib/clang/8.0.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/lib/clang/8.0.0/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++17 -fdeprecated-macro
-fdebug-compilation-dir /tmp/tmp.sMx4UTBWb6 -ferror-limit 19 -fmessage-length
94 -stack-protector 2 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/bug-08d75a.o -x c++
bug.cc -faddrsig 
1.     
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/bits/stl_map.h:1439:8:
at annotation token
2.     
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/ostream:41:1:
parsing namespace 'std'
3.     
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../include/c++/9.1.0/bits/stl_map.h:66:1:
parsing namespace 'std::std'
 #0 0x00007f4b04492fdb llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/bin/../lib/libLLVM-8.so+0x9f5fdb)
 #1 0x00007f4b04490e84 llvm::sys::RunSignalHandlers()
(/usr/bin/../lib/libLLVM-8.so+0x9f3e84)
 #2 0x00007f4b0449100e (/usr/bin/../lib/libLLVM-8.so+0x9f400e)
 #3 0x00007f4b02a5e7e0 __restore_rt (/usr/bin/../lib/libc.so.6+0x3a7e0)
 #4 0x00007f4b02319584 clang::NestedNameSpecifier::isDependent() const
(/usr/bin/../lib/../lib/libclangAST.so.8+0x2d9584)
 #5 0x00007f4b017f810b clang::Sema::computeDeclContext(clang::CXXScopeSpec
const&, bool) (/usr/bin/../lib/../lib/libclangSema.so.8+0x13910b)
 #6 0x00007f4b017faa2e clang::Sema::ActOnCXXEnterDeclaratorScope(clang::Scope*,
clang::CXXScopeSpec&) (/usr/bin/../lib/../lib/libclangSema.so.8+0x13ba2e)
 #7 0x00007f4b01ea1cab (/usr/bin/../lib/../lib/libclangParse.so.8+0x35cab)
 #8 0x00007f4b01ebdb3b clang::Parser::ParseDirectDeclarator(clang::Declarator&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x51b3b)
 #9 0x00007f4b01eb1ef7
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
(/usr/bin/../lib/../lib/libclangParse.so.8+0x45ef7)
#10 0x00007f4b01eb8404 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x4c404)
#11 0x00007f4b01f41376
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/bin/../lib/../lib/libclangParse.so.8+0xd5376)
#12 0x00007f4b01f41d32 (/usr/bin/../lib/../lib/libclangParse.so.8+0xd5d32)
#13 0x00007f4b01f486f1
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/bin/../lib/../lib/libclangParse.so.8+0xdc6f1)
#14 0x00007f4b01ec8fc7
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x5cfc7)
#15 0x00007f4b01ec9cb9 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x5dcb9)
#16 0x00007f4b01ebb4cd
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x4f4cd)
#17 0x00007f4b01f4871b
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/bin/../lib/../lib/libclangParse.so.8+0xdc71b)
#18 0x00007f4b01ec8fc7
clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo,
4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&,
clang::BalancedDelimiterTracker&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x5cfc7)
#19 0x00007f4b01ec9cb9 clang::Parser::ParseNamespace(clang::DeclaratorContext,
clang::SourceLocation&, clang::SourceLocation)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x5dcb9)
#20 0x00007f4b01ebb4cd
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x4f4cd)
#21 0x00007f4b01f4871b
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/bin/../lib/../lib/libclangParse.so.8+0xdc71b)
#22 0x00007f4b01f4936a
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/bin/../lib/../lib/libclangParse.so.8+0xdd36a)
#23 0x00007f4b01e97818 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/bin/../lib/../lib/libclangParse.so.8+0x2b818)
#24 0x00007f4b035bbcf8 clang::CodeGenAction::ExecuteAction()
(/usr/bin/../lib/libclangCodeGen.so.8+0x2eccf8)
#25 0x00007f4b0304d4f6 clang::FrontendAction::Execute()
(/usr/bin/../lib/libclangFrontend.so.8+0xd94f6)
#26 0x00007f4b03007551
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/bin/../lib/libclangFrontend.so.8+0x93551)
#27 0x00007f4b02f6fb15
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/bin/../lib/libclangFrontendTool.so.8+0x4b15)
#28 0x00005633b6f99d39 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/bin/clang-8+0x11d39)
#29 0x00005633b6f96916 main (/usr/bin/clang-8+0xe916)
#30 0x00007f4b02a4aee3 __libc_start_main (/usr/bin/../lib/libc.so.6+0x26ee3)
#31 0x00005633b6f9762e _start (/usr/bin/clang-8+0xf62e)
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to  and include the
crash backtrace, preprocessed source, and associated run script.
clang-8: note: diagnostic msg: Error generating preprocessed source(s).

Crashes with clang 8:

$ clang --version
clang version 8.0.0 (tags/RELEASE_800/final)

Crashes on this commit too:

commit 8d068d6ad41e3e39a0ce34148f968eadd48b53bb
Author: Yaxun Liu <Yaxun.Liu at amd.com>
Date:   Wed Jun 26 03:47:37 2019 +0000

-- 
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/20190626/9bf68202/attachment.html>


More information about the llvm-bugs mailing list