[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1469520 - /subversion/trunk/subversion/libsvn_fs_fs/tree.c

From: Branko Čibej <brane_at_wandisco.com>
Date: Tue, 14 May 2013 13:28:29 +0200

On 14.05.2013 13:02, Philip Martin wrote:
> Branko Čibej <brane_at_wandisco.com> writes:
>
>> This discussion is out of date, I committed a different fix yesterday
>> that doesn't require premature initialization, yet avoids the
>> uninitialized-read problem.
> There was no uninitialized read to avoid. My compiler now produces:
>
> ../src/subversion/libsvn_fs_fs/tree.c: In function 'open_path':
> ../src/subversion/libsvn_fs_fs/tree.c:956:13: warning: 'rest' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> which is essentially the same as the original warning that Blair saw:
>
> ../src/subversion/libsvn_fs_fs/tree.c: In function 'open_path':
> ../src/subversion/libsvn_fs_fs/tree.c:929:27: warning: 'directory' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> These warnings are "maybe" which means there will be false positives and
> different compilers will have different results. I see a number of
> false positives with gcc 4.7.2 and I don't think we should be adding
> spurious initialisation to make them go away.
>
> Why do people want to fix this particular instance?

In both cases, I was not able to determine that the warnings actually
were false positives. That depended on external circumstances outside
the scope of the functions where the warnings were generated.

It is always better to address the warning by changing the code, than to
pooh-pooh it away as a "maybe". I agree, however, that a simple
initialization is often not the correct solution. Hence my attempt at
restructuring the code so that it does not hide potential problems by
initializing stack variables unless it's really necessary.

-- Brane

-- 
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com
Received on 2013-05-14 13:29:11 CEST

This is an archived mail posted to the Subversion Dev mailing list.