x>>32 warning in io.c

Steve Mor Moritsugu mori at dtrbus.com
Fri Mar 21 16:37:23 EST 2003


I download rsync.2.5.6, configure, make clean, but make gives this warning:

"io.c", line 653: warning: shift count negative or too big: >> 32
"io.c", line 653: warning: shift count negative or too big: >> 32
"io.c", line 653: warning: shift count negative or too big: >> 32
"io.c", line 653: warning: shift count negative or too big: >> 32

Another 32 bit shift (<<32) at line 385 does not cause a warning because 
of this test at line 379:
#ifdef NO_INT64
I verified that NO_INT64 is defined on my system in rsync.h

However there is no #ifdef NO_INT64 test protecting line 653.
Here are lines 652,653, and 654 from io.c in subr write_longint:

                              SIVAL(b,0,(x&0xFFFFFFFF));
                              SIVAL(b,4,((x>>32)&0xFFFFFFFF));
                              writefd(f,b,8);

On my system, x>>32 evaluates to the value x, not 0 (since the
shift count is invalid). This will cause the upper 4 bytes of b to be
the same as the lower 4 bytes of b, even if x is a small value.
I am considering using this hack for line 653 to prevent possible problems:

                               SIVAL(b,4,((0)&0xFFFFFFFF));

I really don't do much C programming so I am fumbling in the dark
here. Maybe my hack would make things worse. I have not seen any 
problems yet (rsync can copy test files that cmp verifies later). make 
only shows one other warning or error:
"popt/popt.c", line 910: warning: macro redefined: _ABS

Any advice would be much appreciated.

=== from Steve "Mor" Moritsugu (mori at dtrbus.com)
=== DTR Business Systems Inc (www.dtrbus.com)


More information about the rsync mailing list