]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
avoid warning
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 14 May 2015 21:26:36 +0000 (21:26 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Thu, 14 May 2015 21:26:36 +0000 (21:26 +0000)
m_xarray.c:133:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

(I have double checked that passing a negative argument makes the
assert fail)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15232

coregrind/m_xarray.c

index 285535c6c55129b471f64d29486ad7c362a94a70..726dd55470cabd6b20938d19bd5c5ac67702835c 100644 (file)
@@ -128,9 +128,10 @@ void VG_(setCmpFnXA) ( XArray* xa, XACmpFn_t compar )
 inline void* VG_(indexXA) ( const XArray* xa, Word n )
 {
    vg_assert(xa);
-   // vg_assert(n >= 0); If n negative, the UWord conversion will make
-   // it bigger than usedsizeE.
-   vg_assert((UWord)n < xa->usedsizeE);
+   /* vg_assert(n >= 0); If n negative, the UWord conversion will make
+      it bigger than usedsizeE, which is verified to be non negative when
+      xa is modified. */
+   vg_assert((UWord)n < (UWord)xa->usedsizeE);
    return ((char*)xa->arr) + n * xa->elemSzB;
 }