freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] WIP PATCH: clang static analyzer and warning fixes


From: Sean McBride
Subject: Re: [ft-devel] WIP PATCH: clang static analyzer and warning fixes
Date: Tue, 18 Mar 2014 17:22:42 -0400

On Tue, 18 Mar 2014 17:07:08 -0400, Alexei Podtelezhnikov said:

>> > The patch 0004 is false positive.  The variable 'hit' is set to zero
>> > when entering the loop so 'p_last' and 'p_first' are assigned almost
>> > immediately.
>>
>> Thanks for the analysis.  However, initializing doesn't hurt, and
>> pacifying one of the most used compilers is probably a good thing.
>>
>>
>It is ugly. First we initialize to 0, then twenty lines down we reassign
>both variables to -1.

The assignment with -1 does not always happen; it depends on 2 'if' statements.

The 1st iteration of the 'do' loop at line 551 always starts with hit=0 so the 
first loop will always enter  the 'if !hit' test.  But will subsequent 
iterations of the loop always enter 'if !hit'?  If not, p_first and p_last 
might end up uninitialized.

It could well be a false positive, it's just not clear to someone like me that 
does know this code.  It's also the *only* place in freetype where is compiler 
is also sufficiently unconvinced and therefore warns.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 address@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada





reply via email to

[Prev in Thread] Current Thread [Next in Thread]