FS#29481 - [llvm/clang] clang segfaults when used with -Wuninitialized
Attached to Project:
Arch Linux
Opened by Matthias Schiffer (NeoRaider) - Monday, 16 April 2012, 01:48 GMT
Last edited by Evangelos Foutras (foutrelis) - Monday, 23 April 2012, 19:06 GMT
Opened by Matthias Schiffer (NeoRaider) - Monday, 16 April 2012, 01:48 GMT
Last edited by Evangelos Foutras (foutrelis) - Monday, 23 April 2012, 19:06 GMT
|
Details
Description:
Since 3.0-3 clang nothing but segfaults when used with -Wuninitialized (which is a part of -Wall), seemingly regardless of the actual occurrence of the warning; the existance of a variable declaration inside a function seems to be enough. It even fails for the following simple program: % cat test.c void nop() { int i; } % clang -Wuninitialized test.c 0 libLLVM-3.0.so 0x00007f66d16643df 1 libLLVM-3.0.so 0x00007f66d1664849 2 libpthread.so.0 0x00007f66d07a8140 3 clang 0x0000000000c01982 4 clang 0x0000000000c02427 5 clang 0x0000000000c0421d clang::runUninitializedVariablesAnalysis(clang::DeclContext const&, clang::CFG const&, clang::AnalysisContext&, clang::UninitVariablesHandler&, clang::UninitVariablesAnalysisStats&) + 1597 6 clang 0x0000000000aa32a2 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr const*) + 914 7 clang 0x00000000008644fc clang::Sema::PopFunctionOrBlockScope(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::BlockExpr const*) + 172 8 clang 0x00000000008e09ee clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 334 9 clang 0x000000000080bc7d clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) + 189 10 clang 0x000000000081ca73 clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&) + 963 11 clang 0x000000000082a863 clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 739 12 clang 0x00000000008184b5 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&, clang::AccessSpecifier) + 149 13 clang 0x0000000000818a9d clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::AccessSpecifier) + 717 14 clang 0x000000000081a69b clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 2747 15 clang 0x000000000081abae clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 158 16 clang 0x00000000007f464d clang::ParseAST(clang::Sema&, bool) + 269 17 clang 0x00000000006e6a53 clang::CodeGenAction::ExecuteAction() + 51 18 clang 0x00000000005e9963 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 307 19 clang 0x00000000005d4981 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1041 20 clang 0x00000000005cdfaf cc1_main(char const**, char const**, char const*, void*) + 815 21 clang 0x00000000005ccf6d main + 6957 22 libc.so.6 0x00007f66cff00455 __libc_start_main + 245 23 clang 0x00000000005cdae1 Stack dump: 0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.22.0.20120323 -momit-leaf-frame-pointer -resource-dir /usr/bin/../lib/clang/3.0 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include -internal-externc-isystem /usr/include -Wuninitialized -ferror-limit 19 -fmessage-length 319 -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-wRGm45.o -x c test.c 1. <eof> parser at end of file 2. test.c:1:12: parsing function body 'nop' clang: error: unable to execute command: Segmentation fault (core dumped) [err_drv_command_failure] clang: error: clang frontend command failed due to signal 2 (use -v to see invocation) [err_drv_command_signalled] clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information. clang: note: diagnostic msg: Preprocessed source(s) are located at: clang: note: diagnostic msg: /tmp/test-2anYAv.i |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Monday, 23 April 2012, 19:06 GMT
Reason for closing: Fixed
Additional comments about closing: Added -fno-tree-pre workaround in 3.0-4 which will reach the main repos along with the other libffi 3.0.11 rebuilds.
Monday, 23 April 2012, 19:06 GMT
Reason for closing: Fixed
Additional comments about closing: Added -fno-tree-pre workaround in 3.0-4 which will reach the main repos along with the other libffi 3.0.11 rebuilds.
Program received signal SIGSEGV, Segmentation fault.
dyn_cast_or_null<clang::BinaryOperator, clang::Stmt const> (Val=0x1000) at include/llvm/Support/Casting.h:228
228 return (Val && isa<X>(Val)) ? cast<X>(Val) : 0;
(gdb) bt
#0 dyn_cast_or_null<clang::BinaryOperator, clang::Stmt const> (Val=0x1000) at include/llvm/Support/Casting.h:228
#1 getLogicalOperatorInChain (block=block@entry=0x2905b50) at UninitializedValues.cpp:175
#2 0x0000000000d52706 in runOnBlock (block=block@entry=0x2905b50, cfg=..., ac=..., vals=..., wasAnalyzed=..., handler=handler@entry=0x0) at UninitializedValues.cpp:624
#3 0x0000000000d54593 in clang::runUninitializedVariablesAnalysis (dc=..., cfg=..., ac=..., handler=..., stats=...) at UninitializedValues.cpp:707
#4 0x0000000000bad583 in clang::sema::AnalysisBasedWarnings::IssueWarnings (this=0x27e0ff0, P=..., fscope=<optimized out>, D=0xc, blkExpr=0x0) at AnalysisBasedWarnings.cpp:919
#5 0x000000000092fb44 in clang::Sema::PopFunctionOrBlockScope (this=0x27e02d0, WP=<optimized out>, D=<optimized out>, blkExpr=<optimized out>) at Sema.cpp:805
#6 0x00000000009c318d in clang::Sema::ActOnFinishFunctionBody (this=0x27e02d0, dcl=0x28f5190, Body=0x2903650, IsInstantiation=false) at SemaDecl.cpp:7168
#7 0x00000000008cf84b in clang::Parser::ParseFunctionStatementBody (this=0x27e1990, Decl=0x28f5190, BodyScope=...) at ParseStmt.cpp:1938
#8 0x00000000008e3a9f in clang::Parser::ParseFunctionDefinition (this=0x27e1990, D=..., TemplateInfo=...) at Parser.cpp:966
#9 0x00000000008f2e0a in clang::Parser::ParseDeclGroup (this=0x27e1990, DS=..., Context=0, AllowFunctionDefinitions=<optimized out>, DeclEnd=0x0, FRI=0x0) at ParseDecl.cpp:1021
#10 0x00000000008de265 in clang::Parser::ParseDeclarationOrFunctionDefinition (this=this@entry=0x27e1990, DS=..., AS=AS@entry=clang::AS_none) at Parser.cpp:784
#11 0x00000000008de795 in clang::Parser::ParseDeclarationOrFunctionDefinition (this=this@entry=0x27e1990, attrs=..., AS=AS@entry=clang::AS_none) at Parser.cpp:797
#12 0x00000000008e1e48 in clang::Parser::ParseExternalDeclaration (this=this@entry=0x27e1990, attrs=..., DS=DS@entry=0x0) at Parser.cpp:667
#13 0x00000000008e216e in clang::Parser::ParseTopLevelDecl (this=0x27e1990, Result=...) at Parser.cpp:483
#14 0x00000000008bdc9d in clang::ParseAST (S=..., PrintStats=false) at ParseAST.cpp:84
#15 0x0000000000794704 in clang::CodeGenAction::ExecuteAction (this=0x27bc600) at CodeGenAction.cpp:346
#16 0x0000000000655ca9 in clang::CompilerInstance::ExecuteAction (this=0x27b9810, Act=...) at CompilerInstance.cpp:631
#17 0x0000000000637c62 in clang::ExecuteCompilerInvocation (Clang=0x27b9810) at ExecuteCompilerInvocation.cpp:173
#18 0x000000000062951c in cc1_main (ArgBegin=0x767469074130, ArgEnd=0x767469074290, Argv0=0x27b8598 "/usr/bin/clang", MainAddr=0x6301a0) at cc1_main.cpp:159
#19 0x00000000006368a7 in main (argc_=<optimized out>, argv_=<optimized out>) at driver.cpp:354
full: http://sprunge.us/MCNc