[cfe-dev] [RFC] Adding lifetime analysis to clang

Dmitri Gribenko via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 5 04:47:00 PST 2019


On Mon, Mar 4, 2019 at 7:27 PM Gábor Horváth <xazax.hun at gmail.com> wrote:
>
> On Mon, 4 Mar 2019 at 19:08, George Karpenkov <cheshire at google.com> wrote:
>>
>> > I do not agree. LLVM has good coverage and tests are regularly run with sanitizers on.
>>
>> I'm not entirely convinced: coverage is only line-based and does not cover all executions,
>> and e.g. fuzzers still regularly find new bugs.
>>
>> But in any case it should be easy to find other projects which have more true positives, right?
>
>
> Yeah, we will look into some other projects as well. But, for me, more interesting result will be to rerun it on reverted commits.
> Also, note that we are talking now about the local versions of these lifetime warnings.
> Here are some examples that the local analysis would catch:

Part of the reason why the lifetime analysis is not finding issues in
LLVM and Clang could be that our code allocates most objects, that are
passed around as raw pointers, on arenas (BumpPtrAllocator, included
in ASTContext, for example).

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list