[cfe-dev] segmentation fault while building dominator tree in clang

Abu Naser Masud via cfe-dev cfe-dev at lists.llvm.org
Sat Apr 6 06:57:09 PDT 2019


Hello,

This is my first post in this list. I am building an analysis tool in
ClangTool.I am getting segmentation fault while building a dominator tree
in clang. The sample code that I am using to build the dominator tree is
the following:

*const* Decl* D=*static_cast*<Decl *>(f);     // FunctionDecl f

AnalysisDeclContextManager  *analDeclCtxMgr=*new *AnalysisDeclContextManager
(context);

*if*(AnalysisDeclContext  *analDeclCtx=analDeclCtxMgr->getContext(D)){

   DominatorTree domTree;

   domTree.buildDominatorTree(*analDeclCtx);

}


The input function for my tool is the following code from perlbench(CPU
2017)


*static* *bool*

S_adjust_index(pTHX_ AV *av, *const* MAGIC *mg, SSize_t *keyp)

{

    *bool* adjust_index = 1;

    *if* (mg) {

*/* Handle negative array indices 20020222 MJD */*

SV * *const* ref = SvTIED_obj(MUTABLE_SV(av), mg);

SvGETMAGIC(ref);

*if* (SvROK(ref) && SvOBJECT(SvRV(ref))) {

    SV * *const* * *const* negative_indices_glob =

hv_fetchs(SvSTASH(SvRV(ref)), NEGATIVE_INDICES_VAR, 0);


    *if* (negative_indices_glob && isGV(*negative_indices_glob)

    && SvTRUE(GvSV(*negative_indices_glob)))

adjust_index = 0;

}

    }


    *if* (adjust_index) {

*keyp += AvFILL(av) + 1;

*if* (*keyp < 0)

    *return* *FALSE*;

    }

    *return* *TRUE*;

}


Would you please let me know where the problem is?


Thanks,

Masud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190406/fccf6fea/attachment-0001.html>


More information about the cfe-dev mailing list