subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@wandisco.com>
Subject Re: [PATCH] fix potentially undefined operation warning
Date Thu, 15 May 2014 14:49:08 GMT
On 10.05.2014 05:26, Andreas Stieger 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.

Good catch, the result of these operations is indeed undefined,
according to the C standard.
However, I don't know if your fix is correct ... the other
interpretation is:

        foo(&data, data + 1);
        ++data;

The author of this code should have a look and decide which
interpretation he meant.

-- Brane

-- 
Branko ─îibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com

Mime
View raw message