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

Re: [PATCH] fix potentially undefined operation warning

From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Fri, 16 May 2014 08:24:12 +0200

On Sat, May 10, 2014 at 2:26 PM, Andreas Stieger <andreas.stieger_at_gmx.de>wrote:

> Hello,
>
> I found a compiler warning in trunk on a potentially undefined operation
> when using an increment operator on a variable referenced in the same
> expression. This is on gcc 4.3.4, does not happen in gcc 4.7 and up.
> Treated as an error in some build configurations.
>
> subversion/libsvn_fs_fs/id.c: In function 'txn_id_parse':
> subversion/libsvn_fs_fs/id.c:98: warning: operation on 'data' may be
> undefined
>
> subversion/libsvn_fs_fs/transaction.c: In function 'read_next_ids':
> subversion/libsvn_fs_fs/transaction.c:1300: warning: operation on 'str'
> may be undefined
>
> subversion/libsvn_fs_x/transaction.c: In function 'read_next_ids':
> subversion/libsvn_fs_x/transaction.c:1354: warning: operation on 'str'
> may be undefined
>
> The attached patch fixes this, please review.
>
> [[[
> Fix warnings for potentially undefined operation.
>
> Some code uses increment operators on variables referenced in the same
> operation. See fsfs-improvements branch (r1517479,1506545) and
> fsfs-format-7 (r1453765)
>
> * subversion/libsvn_fs_fs/id.c
> (txn_id_parse): increment data pointer in a separate statement
> * subversion/libsvn_fs_fs/transaction.c
> (read_next_ids): increment str pointer in a separate statement
> * subversion/libsvn_fs_x/transaction.c
> (read_next_ids): same
> ]]]
>

Yuck. Good catch!
Commited last Saturday as r1593795.

Thanks for the patch!

-- Stefan^2.
Received on 2014-05-17 01:43:09 CEST

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