[cfe-dev] Uninitialized Variables Analysis crashing

João Paulo Labegalini de Carvalho via cfe-dev cfe-dev at lists.llvm.org
Mon Sep 24 04:43:50 PDT 2018


You are right, I should have been more specific. In my case crashing means
segmentation fault inside runOnBlock function
(lib/Analysis/UninitializedValues.cpp).

Please find the stack trace attached.

On Mon, Sep 24, 2018 at 4:09 AM Csaba Raduly <rcsaba at gmail.com> wrote:

> Hi João Paulo,
>
>
> On Sun, Sep 23, 2018 at 11:39 PM, João Paulo Labegalini de Carvalho
> via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> > Hi,
> >
> > I have implemented a new Stmt in clang which given
> >
> > __speculate {
> >  // user code
> > }
> >
> > generates LLVM IR equivalent to as if the following code was given:
> >
> ...
> >
> > However, if UninitializedVariablesAnalysis is enabled, clang crashes at
> > runOnBlock function (lib/Analysis/UninitializedValues.cpp). If I disable
> it
> > via -Wno-uninitialized, the code generated runs flawlessly and works as
> > expected.
>
> "crash" is a meaningless term. Does it generate an access violation,
> an assertion failure, or something else?
> What was the error message? Is there a stack trace?
>
>
> Csaba
>
> --
> You can get very substantial performance improvements
> by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
> So if you're looking for a completely portable, 100% standards-conformat
> way
> to get the wrong information: this is what you want. - Scott Meyers
> (C++TDaWYK)
>


-- 
João Paulo L. de Carvalho
Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
jaopaulolc at gmail.com
joao.carvalho at ic.unicamp.br
j160924 at dac.unicamp.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180924/d46a26e1/attachment.html>
-------------- next part --------------
#0 0x00007ff418840dd4 PrintStackTraceSignalHandler(void*) (/opt/clang-tm/bin/../lib/libLLVMSupport.so.6+0xf9dd4)
#1 0x00007ff4188410c6 SignalHandler(int) (/opt/clang-tm/bin/../lib/libLLVMSupport.so.6+0xfa0c6)
#2 0x00007ff41832af70 __restore_rt (/lib64/libpthread.so.0+0x11f70)
#3 0x00007ff416062474 (anonymous namespace)::TransferFunctions::reportUse(clang::Expr const*, clang::VarDecl const*) (/opt/clang-tm/bin/../lib/../lib/libclangAnalysis.so.6+0x77474)
#4 0x00007ff41606086f runOnBlock(clang::CFGBlock const*, clang::CFG const&, clang::AnalysisDeclContext&, (anonymous namespace)::CFGBlockValues&, (anonymous namespace)::ClassifyRefs const&, llvm::BitVector&, clang::UninitVariablesHandler&) (/opt/clang-tm/bin/../lib/../lib/libclangAnalysis.so.6+0x7586f)
#5 0x00007ff41605f54c clang::runUninitializedVariablesAnalysis(clang::DeclContext const&, clang::CFG const&, clang::AnalysisDeclContext&, clang::UninitVariablesHandler&, clang::UninitVariablesAnalysisStats&) (/opt/clang-tm/bin/../lib/../lib/libclangAnalysis.so.6+0x7454c)
#6 0x00007ff4156be442 clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy, clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr const*) (/opt/clang-tm/bin/../lib/../lib/libclangSema.so.6+0xa4442)
#7 0x00007ff415715a7b clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy const*, clang::Decl const*, clang::BlockExpr const*) (/opt/clang-tm/bin/../lib/../lib/libclangSema.so.6+0xfba7b)
#8 0x00007ff415818fb8 clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) (/opt/clang-tm/bin/../lib/../lib/libclangSema.so.6+0x1fefb8)
#9 0x00007ff415db1cff clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xaecff)
#10 0x00007ff415dc61d2 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xc31d2)
#11 0x00007ff415d43058 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0x40058)
#12 0x00007ff415dc505f clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xc205f)
#13 0x00007ff415dc4a59 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xc1a59)
#14 0x00007ff415dc380d clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xc080d)
#15 0x00007ff415dc2cc9 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0xbfcc9)
#16 0x00007ff415d317f6 clang::ParseAST(clang::Sema&, bool, bool) (/opt/clang-tm/bin/../lib/../lib/libclangParse.so.6+0x2e7f6)
#17 0x00007ff417ad8a17 clang::FrontendAction::Execute() (/opt/clang-tm/bin/../lib/libclangFrontend.so.6+0xd6a17)
#18 0x00007ff417a81058 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/clang-tm/bin/../lib/libclangFrontend.so.6+0x7f058)
#19 0x00007ff4179fe4e8 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/clang-tm/bin/../lib/libclangFrontendTool.so.6+0x44e8)
#20 0x0000000000410424 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/clang-tm/bin/clang-6.0+0x410424)
#21 0x000000000040e91d main (/opt/clang-tm/bin/clang-6.0+0x40e91d)
#22 0x00007ff417121feb __libc_start_main /usr/src/debug/glibc-2.27-6.1.x86_64/csu/../csu/libc-start.c:308:16
#23 0x000000000040bb0a _start /home/abuild/rpmbuild/BUILD/glibc-2.27/csu/../sysdeps/x86_64/start.S:122:0
Stack dump:
0.	Program arguments: /opt/clang-tm/bin/clang-6.0 -cc1 -fgnu-tm -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name sequencer.c -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -momit-leaf-frame-pointer -coverage-notes-file /home/jaopaulolc/projetos/llvm-clang-gnu-tm/tm-test/stamp_spear/genome/../obj64/testitm/genome/sequencer.gcno -resource-dir /opt/clang-tm/lib/clang/6.0.1 -dependency-file ../obj64/testitm/genome/sequencer.d -MT ../obj64/testitm/genome/sequencer.o -D LIST_NO_DUPLICATES -D CHUNK_STEP1=12 -I ../lib -I ../ -D _GNU_SOURCE -D TMBUILD=1 -I ../../libitm_rstm -D SEQUENTIAL=0 -D LIBITM=1 -D NOREC=2 -D ITM_MANUAL=3 -internal-isystem /usr/local/include -internal-isystem /opt/clang-tm/lib/clang/6.0.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Wextra -fdebug-compilation-dir /home/jaopaulolc/projetos/llvm-clang-gnu-tm/tm-test/stamp_spear/genome -ferror-limit 19 -fmessage-length 191 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o ../obj64/testitm/genome/sequencer.o -x c sequencer.c 
1.	sequencer.c:669:1: current parser token 'void'
2.	sequencer.c:296:1: parsing function body 'sequencer_run'
clang-6.0: error: unable to execute command: Segmentation fault (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 6.0.1 (https://github.com/llvm-mirror/clang.git 94007aa159086d191e3630bf0990ccc3d3f76199) (https://github.com/llvm-mirror/llvm.git 11ad96963de0de470566d243ac2ef8148bf81ea3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/clang-tm/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-6.0: note: diagnostic msg: 


More information about the cfe-dev mailing list