Bug#855012: clang-3.9: Segmentation fault when compiling

Sylvestre Ledru sylvestre at debian.org
Mon Feb 13 09:14:32 UTC 2017


OK, I can reproduce it with:
$ /usr/lib/llvm-3.9/bin/clang -cc1  -Werror  -Wfatal-errors -x c++
main.cpp -Wall
main.cpp:7:6: fatal error: scoped enumerations are a C++11 extension
enum class action { };
     ^
#0 0x00007f7f57c70125 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/llvm-3.9/bin/../lib/libLLVM-3.9.so.1+0x707125)
#1 0x00007f7f57c6e2de llvm::sys::RunSignalHandlers()
(/usr/lib/llvm-3.9/bin/../lib/libLLVM-3.9.so.1+0x7052de)
#2 0x00007f7f57c6e402
(/usr/lib/llvm-3.9/bin/../lib/libLLVM-3.9.so.1+0x705402)
#3 0x00007f7f5a19b100 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11100)
#4 0x00005634e9d5bbe3 (/usr/lib/llvm-3.9/bin/clang+0x120dbe3)
#5 0x00005634e9d5bd9d (/usr/lib/llvm-3.9/bin/clang+0x120dd9d)
#6 0x00005634e9d5be41 (/usr/lib/llvm-3.9/bin/clang+0x120de41)
#7 0x00005634e9d5f405 (/usr/lib/llvm-3.9/bin/clang+0x1211405)
#8 0x00005634e9d5e13b (/usr/lib/llvm-3.9/bin/clang+0x121013b)
#9 0x00005634e9d60550 clang::CFG::buildCFG(clang::Decl const*,
clang::Stmt*, clang::ASTContext*, clang::CFG::BuildOptions const&)
(/usr/lib/llvm-3.9/bin/clang+0x1212550)
#10 0x00005634e9d4dcfa clang::AnalysisDeclContext::getCFG()
(/usr/lib/llvm-3.9/bin/clang+0x11ffcfa)
#11 0x00005634e9a8c72a
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr
const*) (/usr/lib/llvm-3.9/bin/clang+0xf3e72a)
#12 0x00005634e967e8c7
clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy
const*, clang::Decl const*, clang::BlockExpr const*)
(/usr/lib/llvm-3.9/bin/clang+0xb308c7)
#13 0x00005634e972ec02
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool)
(/usr/lib/llvm-3.9/bin/clang+0xbe0c02)
#14 0x00005634e956d324
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/lib/llvm-3.9/bin/clang+0xa1f324)
#15 0x00005634e94e6894
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&,
clang::Parser::LateParsedAttrList*) (/usr/lib/llvm-3.9/bin/clang+0x998894)
#16 0x00005634e9505407
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-3.9/bin/clang+0x9b7407)
#17 0x00005634e94e2032
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/lib/llvm-3.9/bin/clang+0x994032)
#18 0x00005634e94e26f1 (/usr/lib/llvm-3.9/bin/clang+0x9946f1)
#19 0x00005634e94e271f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/lib/llvm-3.9/bin/clang+0x99471f)
#20 0x00005634e94e884f
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-3.9/bin/clang+0x99a84f)
#21 0x00005634e94e9204
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-3.9/bin/clang+0x99b204)
#22 0x00005634e94ddb1b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-3.9/bin/clang+0x98fb1b)
#23 0x00005634e92b7e26 clang::FrontendAction::Execute()
(/usr/lib/llvm-3.9/bin/clang+0x769e26)
#24 0x00005634e928aa76
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-3.9/bin/clang+0x73ca76)
#25 0x00005634e9333553
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-3.9/bin/clang+0x7e5553)
#26 0x00005634e8f99a98 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*) (/usr/lib/llvm-3.9/bin/clang+0x44ba98)
#27 0x00005634e8f8d683 main (/usr/lib/llvm-3.9/bin/clang+0x43f683)
#28 0x00007f7f5671b2b1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202b1)
#29 0x00005634e8f97e0a _start (/usr/lib/llvm-3.9/bin/clang+0x449e0a)
Stack dump:
0.    Program arguments: /usr/lib/llvm-3.9/bin/clang -cc1 -Werror
-Wfatal-errors -x c++ main.cpp -Wall
1.    <eof> parser at end of file
2.    main.cpp:25:1: parsing function body 'fun'
Erreur de segmentation




Le 13/02/2017 à 09:54, Eric Peter STAVARACHE a écrit :
> The include error is because it uses the libs provided by gcc 6.3.0
>
> Try this version that does not include anything.
>
>
>
> struct StructA;
> struct StructB;
> struct StructC;
>
> enum class action { };
>
> template<typename T>
> struct shared_ptr
> {
>
>     shared_ptr(T*)
>     {
>
>     }
>
> };
>
> static action foo(StructA &eth_context)
> {
> }
>
> static void fun(struct StructB *response, void *callbackContext)
> {
>     shared_ptr<StructC> context =
>     shared_ptr<StructC>(reinterpret_cast<StructC *>(callbackContext));
> }
> ________________________________________
> From: Sylvestre Ledru <sylvestre at debian.org>
> Sent: Monday, February 13, 2017 10:39 AM
> To: Eric Peter STAVARACHE; 855012 at bugs.debian.org
> Subject: Re: Bug#855012: clang-3.9: Segmentation fault when compiling
>
> Le 13/02/2017 à 09:27, Eric Peter Stavarache a écrit :
>> Package: clang-3.9
>> Version: 1:3.9.1-4
>> Severity: important
>>
>> Dear Maintainer,
>>
>>
>> This the code in question:
>>
> I am getting with your command line:
> ---
> main.cpp:1:10: fatal error: 'memory' file not found
> #include <memory>
>          ^
> 1 error generated.
> ---
>
> If I comment the include, I am getting:
> main.cpp:9:28: fatal error: unused parameter 'eth_context'
> [-Wunused-parameter]
> static action foo(StructA &eth_context)
>                            ^
> 1 error generated.
>
>
> Can you tell me more?
>
> S
>
>
> ________________________
> This email was scanned by Bitdefender
>



More information about the Pkg-llvm-team mailing list