Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15499 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c
index 5ff0d28..fd27d60 100644
--- a/coregrind/m_addrinfo.c
+++ b/coregrind/m_addrinfo.c
@@ -420,22 +420,21 @@
 
       case Addr_Unknown:
          if (maybe_gcc) {
-            VG_(emit)( "%sAddress 0x%llx is just below the stack ptr.  "
+            VG_(emit)( "%sAddress 0x%lx is just below the stack ptr.  "
                        "To suppress, use: --workaround-gcc296-bugs=yes%s\n",
-                       xpre, (ULong)a, xpost );
+                       xpre, a, xpost );
 	 } else {
-            VG_(emit)( "%sAddress 0x%llx "
+            VG_(emit)( "%sAddress 0x%lx "
                        "is not stack'd, malloc'd or %s%s\n",
-                       xpre, 
-                       (ULong)a, 
+                       xpre, a,
                        mc ? "(recently) free'd" : "on a free list",
                        xpost );
          }
          break;
 
       case Addr_Stack: 
-         VG_(emit)( "%sAddress 0x%llx is on thread %s%d's stack%s\n", 
-                    xpre, (ULong)a, 
+         VG_(emit)( "%sAddress 0x%lx is on thread %s%u's stack%s\n", 
+                    xpre, a, 
                     opt_tnr_prefix (ai->Addr.Stack.tinfo), 
                     tnr_else_tid (ai->Addr.Stack.tinfo), 
                     xpost );
@@ -459,7 +458,7 @@
 
             HChar strlinenum[16] = "";   // large enough
             if (hasfile && haslinenum)
-               VG_(sprintf)(strlinenum, "%d", linenum);
+               VG_(sprintf)(strlinenum, "%u", linenum);
 
             hasfn = VG_(get_fnname)(ai->Addr.Stack.IP, &fn);
 
@@ -563,7 +562,7 @@
          }
          if (ai->Addr.Block.alloc_tinfo.tnr || ai->Addr.Block.alloc_tinfo.tid)
             VG_(emit)(
-               "%sBlock was alloc'd by thread %s%d%s\n",
+               "%sBlock was alloc'd by thread %s%u%s\n",
                xpre,
                opt_tnr_prefix (ai->Addr.Block.alloc_tinfo),
                tnr_else_tid (ai->Addr.Block.alloc_tinfo),
@@ -573,10 +572,9 @@
       }
 
       case Addr_DataSym:
-         VG_(emit)( "%sAddress 0x%llx is %llu bytes "
+         VG_(emit)( "%sAddress 0x%lx is %llu bytes "
                     "inside data symbol \"%pS\"%s\n",
-                    xpre,
-                    (ULong)a,
+                    xpre, a,
                     (ULong)ai->Addr.DataSym.offset,
                     ai->Addr.DataSym.name,
                     xpost );
@@ -597,9 +595,8 @@
          break;
 
       case Addr_SectKind:
-         VG_(emit)( "%sAddress 0x%llx is in the %pS segment of %pS%s\n",
-                    xpre,
-                    (ULong)a,
+         VG_(emit)( "%sAddress 0x%lx is in the %pS segment of %pS%s\n",
+                    xpre, a,
                     VG_(pp_SectKind)(ai->Addr.SectKind.kind),
                     ai->Addr.SectKind.objname,
                     xpost );
@@ -612,29 +609,27 @@
 
       case Addr_BrkSegment:
          if (a < ai->Addr.BrkSegment.brk_limit)
-            VG_(emit)( "%sAddress 0x%llx is in the brk data segment"
-                       " 0x%llx-0x%llx%s\n",
-                       xpre,
-                       (ULong)a,
-                       (ULong)VG_(brk_base),
-                       (ULong)ai->Addr.BrkSegment.brk_limit - 1,
+            VG_(emit)( "%sAddress 0x%lx is in the brk data segment"
+                       " 0x%lx-0x%lx%s\n",
+                       xpre, a,
+                       VG_(brk_base),
+                       ai->Addr.BrkSegment.brk_limit - 1,
                        xpost );
          else
-            VG_(emit)( "%sAddress 0x%llx is %lu bytes after "
+            VG_(emit)( "%sAddress 0x%lx is %lu bytes after "
                        "the brk data segment limit"
-                       " 0x%llx%s\n",
-                       xpre,
-                       (ULong)a,
+                       " 0x%lx%s\n",
+                       xpre, a,
                        a - ai->Addr.BrkSegment.brk_limit,
-                       (ULong)ai->Addr.BrkSegment.brk_limit,
+                       ai->Addr.BrkSegment.brk_limit,
                        xpost );
          break;
 
       case Addr_SegmentKind:
-         VG_(emit)( "%sAddress 0x%llx is in "
+         VG_(emit)( "%sAddress 0x%lx is in "
                     "a %s%s%s %s%s%pS segment%s\n",
                     xpre,
-                    (ULong)a,
+                    a,
                     ai->Addr.SegmentKind.hasR ? "r" : "-",
                     ai->Addr.SegmentKind.hasW ? "w" : "-",
                     ai->Addr.SegmentKind.hasX ? "x" : "-",
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index 9fe0dff..9da5aaf 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -442,10 +442,10 @@
 
    VG_(debugLog)(
       logLevel, "aspacem",
-      "%3d: %s %010llx-%010llx %s %c%c%c%c%c %s "
-      "d=0x%03llx i=%-7lld o=%-7lld (%d,%d) %s\n",
+      "%3d: %s %010lx-%010lx %s %c%c%c%c%c %s "
+      "d=0x%03llx i=%-7llu o=%-7lld (%d,%d) %s\n",
       segNo, show_SegKind(seg->kind),
-      (ULong)seg->start, (ULong)seg->end, len_buf,
+      seg->start, seg->end, len_buf,
       seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-', 
       seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',
       seg->isCH ? 'H' : '-',
@@ -469,18 +469,18 @@
       case SkFree:
          VG_(debugLog)(
             logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %s\n",
+            "%3d: %s %010lx-%010lx %s\n",
             segNo, show_SegKind(seg->kind),
-            (ULong)seg->start, (ULong)seg->end, len_buf
+            seg->start, seg->end, len_buf
          );
          break;
 
       case SkAnonC: case SkAnonV: case SkShmC:
          VG_(debugLog)(
             logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %s %c%c%c%c%c\n",
+            "%3d: %s %010lx-%010lx %s %c%c%c%c%c\n",
             segNo, show_SegKind(seg->kind),
-            (ULong)seg->start, (ULong)seg->end, len_buf,
+            seg->start, seg->end, len_buf,
             seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-', 
             seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-',
             seg->isCH ? 'H' : '-'
@@ -490,10 +490,10 @@
       case SkFileC: case SkFileV:
          VG_(debugLog)(
             logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %s %c%c%c%c%c d=0x%03llx "
-            "i=%-7lld o=%-7lld (%d,%d)\n",
+            "%3d: %s %010lx-%010lx %s %c%c%c%c%c d=0x%03llx "
+            "i=%-7llu o=%-7lld (%d,%d)\n",
             segNo, show_SegKind(seg->kind),
-            (ULong)seg->start, (ULong)seg->end, len_buf,
+            seg->start, seg->end, len_buf,
             seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-', 
             seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-', 
             seg->isCH ? 'H' : '-',
@@ -505,9 +505,9 @@
       case SkResvn:
          VG_(debugLog)(
             logLevel, "aspacem",
-            "%3d: %s %010llx-%010llx %s %c%c%c%c%c %s\n",
+            "%3d: %s %010lx-%010lx %s %c%c%c%c%c %s\n",
             segNo, show_SegKind(seg->kind),
-            (ULong)seg->start, (ULong)seg->end, len_buf,
+            seg->start, seg->end, len_buf,
             seg->hasR ? 'r' : '-', seg->hasW ? 'w' : '-', 
             seg->hasX ? 'x' : '-', seg->hasT ? 'T' : '-', 
             seg->isCH ? 'H' : '-',
@@ -915,9 +915,9 @@
               "segment mismatch: V's seg 1st, kernel's 2nd:\n");
          show_nsegment_full( 0, i, &nsegments[i] );
          VG_(debugLog)(0,"aspacem", 
-            "...: .... %010llx-%010llx %s %c%c%c.. ....... "
-            "d=0x%03llx i=%-7lld o=%-7lld (.) m=. %s\n",
-            (ULong)start, (ULong)end, len_buf,
+            "...: .... %010lx-%010lx %s %c%c%c.. ....... "
+            "d=0x%03llx i=%-7llu o=%-7lld (.) m=. %s\n",
+            start, end, len_buf,
             prot & VKI_PROT_READ  ? 'r' : '-',
             prot & VKI_PROT_WRITE ? 'w' : '-',
             prot & VKI_PROT_EXEC  ? 'x' : '-',
@@ -982,8 +982,8 @@
               "segment mismatch: V's gap 1st, kernel's 2nd:\n");
          show_nsegment_full( 0, i, &nsegments[i] );
          VG_(debugLog)(0,"aspacem", 
-            "   : .... %010llx-%010llx %s\n",
-            (ULong)start, (ULong)end, len_buf);
+            "   : .... %010lx-%010lx %s\n",
+            start, end, len_buf);
          return;
       }
    }
@@ -1712,8 +1712,8 @@
       accordingly. */
 
    VG_(debugLog)(2, "aspacem", 
-                    "        sp_at_startup = 0x%010llx (supplied)\n", 
-                    (ULong)sp_at_startup );
+                    "        sp_at_startup = 0x%010lx (supplied)\n", 
+                    sp_at_startup );
 
 #  if VG_WORDSIZE == 8
      aspacem_maxAddr = (Addr)0x1000000000ULL - 1; // 64G
@@ -1746,20 +1746,20 @@
    aspacem_assert(VG_IS_PAGE_ALIGNED(suggested_clstack_end + 1));
 
    VG_(debugLog)(2, "aspacem", 
-                    "              minAddr = 0x%010llx (computed)\n", 
-                    (ULong)aspacem_minAddr);
+                    "              minAddr = 0x%010lx (computed)\n", 
+                    aspacem_minAddr);
    VG_(debugLog)(2, "aspacem", 
-                    "              maxAddr = 0x%010llx (computed)\n", 
-                    (ULong)aspacem_maxAddr);
+                    "              maxAddr = 0x%010lx (computed)\n", 
+                    aspacem_maxAddr);
    VG_(debugLog)(2, "aspacem", 
-                    "               cStart = 0x%010llx (computed)\n", 
-                    (ULong)aspacem_cStart);
+                    "               cStart = 0x%010lx (computed)\n", 
+                    aspacem_cStart);
    VG_(debugLog)(2, "aspacem", 
-                    "               vStart = 0x%010llx (computed)\n", 
-                    (ULong)aspacem_vStart);
+                    "               vStart = 0x%010lx (computed)\n", 
+                    aspacem_vStart);
    VG_(debugLog)(2, "aspacem", 
-                    "suggested_clstack_end = 0x%010llx (computed)\n", 
-                    (ULong)suggested_clstack_end);
+                    "suggested_clstack_end = 0x%010lx (computed)\n", 
+                    suggested_clstack_end);
 
    if (aspacem_cStart > Addr_MIN) {
       init_resvn(&seg, Addr_MIN, aspacem_cStart-1);
@@ -1881,8 +1881,8 @@
 
    if (0) {
       VG_(am_show_nsegments)(0,"getAdvisory");
-      VG_(debugLog)(0,"aspacem", "getAdvisory 0x%llx %lld\n", 
-                      (ULong)req->start, (ULong)req->len);
+      VG_(debugLog)(0,"aspacem", "getAdvisory 0x%lx %lu\n",
+                    req->start, req->len);
    }
 
    /* Reject zero-length requests */
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index bf510a3..ec469a0 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -307,7 +307,7 @@
          } else {
             VG_(printf)("\nUnhandled error type: %u. VG_(needs).tool_errors\n"
                         "probably needs to be set.\n",
-                        e1->ekind);
+                        (UInt)e1->ekind);
             VG_(core_panic)("unhandled error type");
          }
    }
@@ -591,7 +591,7 @@
       /* standard preamble */
       VG_(printf_xml)("<error>\n");
       VG_(printf_xml)("  <unique>0x%x</unique>\n", err->unique);
-      VG_(printf_xml)("  <tid>%d</tid>\n", err->tid);
+      VG_(printf_xml)("  <tid>%u</tid>\n", err->tid);
       ThreadState* tst = VG_(get_ThreadState)(err->tid);
       if (tst->thread_name) {
          VG_(printf_xml)("  <threadname>%s</threadname>\n", tst->thread_name);
@@ -617,9 +617,9 @@
           && err->tid > 0 && err->tid != last_tid_printed) {
          ThreadState* tst = VG_(get_ThreadState)(err->tid);
          if (tst->thread_name) {
-            VG_(umsg)("Thread %d %s:\n", err->tid, tst->thread_name );
+            VG_(umsg)("Thread %u %s:\n", err->tid, tst->thread_name );
          } else {
-            VG_(umsg)("Thread %d:\n", err->tid );
+            VG_(umsg)("Thread %u:\n", err->tid );
          }
          last_tid_printed = err->tid;
       }
@@ -981,7 +981,7 @@
 
    /* We only get here if not printing XML. */
    VG_(umsg)("ERROR SUMMARY: "
-             "%d errors from %d contexts (suppressed: %d from %d)\n",
+             "%u errors from %u contexts (suppressed: %u from %u)\n",
              n_errs_found, n_err_contexts, 
              n_errs_suppressed, n_supp_contexts );
 
@@ -1009,7 +1009,7 @@
       if (p_min == NULL) continue; //VG_(core_panic)("show_all_errors()");
 
       VG_(umsg)("\n");
-      VG_(umsg)("%d errors in context %d of %d:\n",
+      VG_(umsg)("%d errors in context %d of %u:\n",
                 p_min->count, i+1, n_err_contexts);
       pp_Error( p_min, False/*allow_db_attach*/, False /* xml */ );
 
@@ -1041,7 +1041,7 @@
    // reprint this, so users don't have to scroll way up to find
    // the first printing
    VG_(umsg)("ERROR SUMMARY: "
-             "%d errors from %d contexts (suppressed: %d from %d)\n",
+             "%u errors from %u contexts (suppressed: %u from %u)\n",
              n_errs_found, n_err_contexts, n_errs_suppressed,
              n_supp_contexts );
 }
@@ -1891,7 +1891,7 @@
             VG_(printf)(
                "\nUnhandled suppression type: %u.  VG_(needs).tool_errors\n"
                "probably needs to be set.\n",
-               err->ekind);
+               (UInt)err->ekind);
             VG_(core_panic)("unhandled suppression type");
          }
    }
diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c
index 32219c9..dee8963 100644
--- a/coregrind/m_hashtable.c
+++ b/coregrind/m_hashtable.c
@@ -308,7 +308,7 @@
           || key_occurences[i] > 0 
           || cno_occurences[i] > 0)
          VG_(message)(Vg_DebugMsg,
-                      "%s=%2d : nr chain %6d, nr keys %6d, nr elts %6d\n",
+                      "%s=%2u : nr chain %6u, nr keys %6u, nr elts %6u\n",
                       i == MAXOCCUR ? ">" : "N", i,
                       cno_occurences[i], key_occurences[i], elt_occurences[i]);
       nkey += key_occurences[i];
@@ -316,7 +316,7 @@
       ncno += cno_occurences[i];
    }
    VG_(message)(Vg_DebugMsg, 
-                "total nr of unique   slots: %6d, keys %6d, elts %6d."
+                "total nr of unique   slots: %6u, keys %6u, elts %6u."
                 " Avg chain len %3.1f\n",
                 ncno, nkey, nelt,
                 (Double)nelt/(Double)(ncno == cno_occurences[0] ?
diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
index d8ff159..d84191c 100644
--- a/coregrind/m_initimg/initimg-linux.c
+++ b/coregrind/m_initimg/initimg-linux.c
@@ -478,7 +478,7 @@
       auxsize +                               /* auxv */
       VG_ROUNDUP(stringsize, sizeof(Word));   /* strings (aligned) */
 
-   if (0) VG_(printf)("stacksize = %d\n", stacksize);
+   if (0) VG_(printf)("stacksize = %u\n", stacksize);
 
    /* client_SP is the client's stack pointer */
    client_SP = clstack_end - stacksize;
@@ -494,10 +494,10 @@
    clstack_max_size = VG_PGROUNDUP(clstack_max_size);
 
    if (0)
-      VG_(printf)("stringsize=%d auxsize=%d stacksize=%d maxsize=0x%x\n"
+      VG_(printf)("stringsize=%u auxsize=%u stacksize=%u maxsize=0x%lx\n"
                   "clstack_start %p\n"
                   "clstack_end   %p\n",
-	          stringsize, auxsize, stacksize, (Int)clstack_max_size,
+                  stringsize, auxsize, stacksize, clstack_max_size,
                   (void*)clstack_start, (void*)clstack_end);
 
    /* ==================== allocate space ==================== */
@@ -815,7 +815,7 @@
          default:
             /* stomp out anything we don't know about */
             VG_(debugLog)(2, "initimg",
-                             "stomping auxv entry %lld\n", 
+                             "stomping auxv entry %llu\n", 
                              (ULong)auxv->a_type);
             auxv->a_type = AT_IGNORE;
             break;
@@ -960,7 +960,7 @@
       if (szB < m1) szB = m1;
       szB = VG_PGROUNDUP(szB);
       VG_(debugLog)(1, "initimg",
-                       "Setup client stack: size will be %ld\n", szB);
+                       "Setup client stack: size will be %lu\n", szB);
 
       iifii.clstack_max_size = szB;
 
@@ -980,9 +980,9 @@
                        (void*)VG_(brk_base) );
       VG_(debugLog)(2, "initimg",
                        "Client info: "
-                       "initial_SP=%p max_stack_size=%ld\n",
+                       "initial_SP=%p max_stack_size=%lu\n",
                        (void*)(iifii.initial_client_SP),
-                       (SizeT)iifii.clstack_max_size );
+                       iifii.clstack_max_size );
    }
 
    //--------------------------------------------------------------
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 0545205..2d45838 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -362,7 +362,7 @@
    }
 
    VG_(printf)("\nsched status:\n"); 
-   VG_(printf)("  running_tid=%d\n", VG_(get_running_tid)());
+   VG_(printf)("  running_tid=%u\n", VG_(get_running_tid)());
    for (i = 1; i < VG_N_THREADS; i++) {
       VgStack* stack 
          = (VgStack*)VG_(threads)[i].os_state.valgrind_stack_base;
@@ -389,7 +389,7 @@
             VG_(printf)("client stack range: ???????\n");
       }
       if (stack_usage && stack != 0)
-          VG_(printf)("valgrind stack top usage: %ld of %ld\n",
+          VG_(printf)("valgrind stack top usage: %lu of %lu\n",
                       VG_(clo_valgrind_stacksize)
                         - VG_(am_get_VgStack_unused_szB)
                                (stack, VG_(clo_valgrind_stacksize)),
diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
index 87473c6..1c1d4b5 100644
--- a/coregrind/m_machine.c
+++ b/coregrind/m_machine.c
@@ -191,7 +191,7 @@
                                                         const HChar*, Addr))
 {
    VexGuestArchState* vex = &(VG_(get_ThreadState)(tid)->arch.vex);
-   VG_(debugLog)(2, "machine", "apply_to_GPs_of_tid %d\n", tid);
+   VG_(debugLog)(2, "machine", "apply_to_GPs_of_tid %u\n", tid);
 #if defined(VGA_x86)
    (*f)(tid, "EAX", vex->guest_EAX);
    (*f)(tid, "ECX", vex->guest_ECX);
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index a842691..0ce771c 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -1532,8 +1532,8 @@
 #  endif
 
    if (show)
-      VG_(printf)("fd limits: host, before: cur %lu max %lu\n", 
-                  (UWord)rl.rlim_cur, (UWord)rl.rlim_max);
+      VG_(printf)("fd limits: host, before: cur %llu max %llu\n", 
+                  (ULong)rl.rlim_cur, (ULong)rl.rlim_max);
 
    /* Work out where to move the soft limit to. */
    if (rl.rlim_cur + N_RESERVED_FDS <= rl.rlim_max) {
@@ -1552,7 +1552,7 @@
    if (show) {
       VG_(printf)("fd limits: host,  after: cur %lu max %lu\n",
                   (UWord)rl.rlim_cur, (UWord)rl.rlim_max);
-      VG_(printf)("fd limits: guest       : cur %u max %u\n",
+      VG_(printf)("fd limits: guest       : cur %d max %d\n",
                   VG_(fd_soft_limit), VG_(fd_hard_limit));
    }
 
@@ -2698,7 +2698,7 @@
       sys_exit, do likewise; if the (last) thread stopped due to a fatal
       signal, terminate the entire system with that same fatal signal. */
    VG_(debugLog)(1, "core_os", 
-                    "VG_(terminate_NORETURN)(tid=%lld)\n", (ULong)tid);
+                    "VG_(terminate_NORETURN)(tid=%u)\n", tid);
 
    switch (tids_schedretcode) {
    case VgSrc_ExitThread:  /* the normal way out (Linux, Solaris) */
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index 42f029c..b8e994c 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -877,7 +877,7 @@
    if (a->stats__bytes_mmaped > a->stats__bytes_mmaped_max)
       a->stats__bytes_mmaped_max = a->stats__bytes_mmaped;
    VG_(debugLog)(1, "mallocfree",
-                    "newSuperblock at %p (pszB %7ld) %s owner %s/%s\n", 
+                    "newSuperblock at %p (pszB %7lu) %s owner %s/%s\n", 
                     sb, sb->n_payload_bytes,
                     (unsplittable ? "unsplittable" : ""),
                     a->clientmem ? "CLIENT" : "VALGRIND", a->name );
@@ -895,7 +895,7 @@
    UInt   i, j;
 
    VG_(debugLog)(1, "mallocfree",
-                    "reclaimSuperblock at %p (pszB %7ld) %s owner %s/%s\n", 
+                    "reclaimSuperblock at %p (pszB %7lu) %s owner %s/%s\n", 
                     sb, sb->n_payload_bytes,
                     (sb->unsplittable ? "unsplittable" : ""),
                     a->clientmem ? "CLIENT" : "VALGRIND", a->name );
@@ -1220,13 +1220,13 @@
       Superblock * sb = a->sblocks[j];
 
       VG_(printf)( "\n" );
-      VG_(printf)( "superblock %d at %p %s, sb->n_pl_bs = %lu\n",
+      VG_(printf)( "superblock %u at %p %s, sb->n_pl_bs = %lu\n",
                    blockno++, sb, (sb->unsplittable ? "unsplittable" : ""),
                    sb->n_payload_bytes);
       for (i = 0; i < sb->n_payload_bytes; i += b_bszB) {
          Block* b = (Block*)&sb->payload_bytes[i];
          b_bszB   = get_bszB(b);
-         VG_(printf)( "   block at %d, bszB %lu: ", i, b_bszB );
+         VG_(printf)( "   block at %u, bszB %lu: ", i, b_bszB );
          VG_(printf)( "%s, ", is_inuse_block(b) ? "inuse" : "free");
          VG_(printf)( "%s\n", blockSane(a, b) ? "ok" : "BAD" );
       }
@@ -1276,13 +1276,13 @@
          b     = (Block*)&sb->payload_bytes[i];
          b_bszB = get_bszB_as_is(b);
          if (!blockSane(a, b)) {
-            VG_(printf)("sanity_check_malloc_arena: sb %p, block %d "
+            VG_(printf)("sanity_check_malloc_arena: sb %p, block %u "
                         "(bszB %lu):  BAD\n", sb, i, b_bszB );
             BOMB;
          }
          thisFree = !is_inuse_block(b);
          if (thisFree && lastWasFree) {
-            VG_(printf)("sanity_check_malloc_arena: sb %p, block %d "
+            VG_(printf)("sanity_check_malloc_arena: sb %p, block %u "
                         "(bszB %lu): UNMERGED FREES\n", sb, i, b_bszB );
             BOMB;
          }
@@ -1323,7 +1323,7 @@
          b_prev = b;
          b = get_next_b(b);
          if (get_prev_b(b) != b_prev) {
-            VG_(printf)( "sanity_check_malloc_arena: list %d at %p: "
+            VG_(printf)( "sanity_check_malloc_arena: list %u at %p: "
                          "BAD LINKAGE\n",
                          listno, b );
             BOMB;
@@ -1331,7 +1331,7 @@
          b_pszB = get_pszB(a, b);
          if (b_pszB < list_min_pszB || b_pszB > list_max_pszB) {
             VG_(printf)(
-               "sanity_check_malloc_arena: list %d at %p: "
+               "sanity_check_malloc_arena: list %u at %p: "
                "WRONG CHAIN SIZE %luB (%luB, %luB)\n",
                listno, b, b_pszB, list_min_pszB, list_max_pszB );
             BOMB;
@@ -1353,8 +1353,8 @@
 
    if (VG_(clo_verbosity) > 2) 
       VG_(message)(Vg_DebugMsg,
-                   "%-8s: %2d sbs, %5d bs, %2d/%-2d free bs, "
-                   "%7ld mmap, %7ld loan\n",
+                   "%-8s: %2u sbs, %5u bs, %2u/%-2u free bs, "
+                   "%7lu mmap, %7lu loan\n",
                    a->name,
                    superblockctr,
                    blockctr_sb, blockctr_sb_free, blockctr_li, 
@@ -1764,7 +1764,7 @@
       a->sblocks_size *= 2;
       a->sblocks = array;
       VG_(debugLog)(1, "mallocfree", 
-                       "sblock array for arena `%s' resized to %ld\n", 
+                       "sblock array for arena `%s' resized to %lu\n", 
                        a->name, a->sblocks_size);
    }
 
@@ -1892,7 +1892,7 @@
                     a->clientmem ? "CLIENT" : "VALGRIND", a->name );
    } else
       VG_(debugLog)(1, "mallocfree",
-                    "deferred_reclaimSuperblock at %p (pszB %7ld) %s "
+                    "deferred_reclaimSuperblock at %p (pszB %7lu) %s "
                     "(prev %p) owner %s/%s\n",
                     sb, sb->n_payload_bytes,
                     (sb->unsplittable ? "unsplittable" : ""),
@@ -2457,8 +2457,8 @@
 
          sb->n_payload_bytes -= frag_bszB;
          VG_(debugLog)(1, "mallocfree",
-                       "shrink superblock %p to (pszB %7ld) "
-                       "owner %s/%s (munmap-ing %p %7ld)\n",
+                       "shrink superblock %p to (pszB %7lu) "
+                       "owner %s/%s (munmap-ing %p %7lu)\n",
                        sb, sb->n_payload_bytes,
                        a->clientmem ? "CLIENT" : "VALGRIND", a->name,
                        (void*) frag, frag_bszB);
diff --git a/coregrind/m_sbprofile.c b/coregrind/m_sbprofile.c
index f64260f..0b8022b 100644
--- a/coregrind/m_sbprofile.c
+++ b/coregrind/m_sbprofile.c
@@ -72,7 +72,7 @@
    VG_(printf)("<<<\n");
    VG_(printf)("\n");
 
-   VG_(printf)("Total score = %'lld\n\n", score_total);
+   VG_(printf)("Total score = %'llu\n\n", score_total);
 
    /* Print an initial per-block summary. */
    VG_(printf)("rank  ---cumulative---      -----self-----\n");
@@ -96,7 +96,7 @@
       Double percent_here =
          score_total == 0 ? 100.0 : score_here * 100.0 / score_total;
         
-      VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
+      VG_(printf)("%3d: (%9llu %5.2f%%)   %9llu %5.2f%%      0x%lx %s\n",
                   r,
                   score_cumul, percent_cumul,
                   score_here,  percent_here, tops[r].addr, name);
@@ -138,7 +138,7 @@
          VG_(printf)("\n");
          VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= begin SB rank %d "
                      "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r);
-         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
+         VG_(printf)("%3d: (%9llu %5.2f%%)   %9llu %5.2f%%      0x%lx %s\n",
                      r,
                      score_cumul, percent_cumul,
                      score_here,  percent_here, tops[r].addr, name );
@@ -170,7 +170,7 @@
          Double percent_here =
            score_total == 0 ? 100.0 : score_here * 100.0 / score_total;
 
-         VG_(printf)("%3d: (%9lld %5.2f%%)   %9lld %5.2f%%      0x%lx %s\n",
+         VG_(printf)("%3d: (%9llu %5.2f%%)   %9llu %5.2f%%      0x%lx %s\n",
                      r,
                      score_cumul, percent_cumul,
                      score_here,  percent_here, tops[r].addr, name );
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index d80cfc9..f59bff7 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -1145,7 +1145,7 @@
    m_SP  = VG_(get_SP)(tid);
 
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("sys_sigaltstack: tid %d, "
+      VG_(dmsg)("sys_sigaltstack: tid %u, "
                 "ss %p{%p,sz=%llu,flags=0x%llx}, oss %p (current SP %p)\n",
                 tid, (void*)ss, 
                 ss ? ss->ss_sp : 0,
@@ -1339,7 +1339,7 @@
 		  vki_sigset_t* oldset )
 {
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("do_setmask: tid = %d how = %d (%s), newset = %p (%s)\n", 
+      VG_(dmsg)("do_setmask: tid = %u how = %d (%s), newset = %p (%s)\n", 
                 tid, how,
                 how==VKI_SIG_BLOCK ? "SIG_BLOCK" : (
                    how==VKI_SIG_UNBLOCK ? "SIG_UNBLOCK" : (
@@ -1440,7 +1440,7 @@
    tst = & VG_(threads)[tid];
 
    if (VG_(clo_trace_signals)) {
-      VG_(dmsg)("push_signal_frame (thread %d): signal %d\n", tid, sigNo);
+      VG_(dmsg)("push_signal_frame (thread %u): signal %d\n", tid, sigNo);
       VG_(get_and_pp_StackTrace)(tid, 10);
    }
 
@@ -1455,7 +1455,7 @@
       esp_top_of_frame 
          = (Addr)(tst->altstack.ss_sp) + tst->altstack.ss_size;
       if (VG_(clo_trace_signals))
-         VG_(dmsg)("delivering signal %d (%s) to thread %d: "
+         VG_(dmsg)("delivering signal %d (%s) to thread %u: "
                    "on ALT STACK (%p-%p; %ld bytes)\n",
                    sigNo, VG_(signame)(sigNo), tid, tst->altstack.ss_sp,
                    (UChar *)tst->altstack.ss_sp + tst->altstack.ss_size,
@@ -1935,7 +1935,7 @@
    ThreadState		*tst = VG_(get_ThreadState)(tid);
 
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("delivering signal %d (%s):%d to thread %d\n", 
+      VG_(dmsg)("delivering signal %d (%s):%d to thread %u\n", 
                 sigNo, VG_(signame)(sigNo), info->si_code, tid );
 
    if (sigNo == VG_SIGVGKILL) {
@@ -2195,7 +2195,7 @@
    sq = tst->sig_queue;
 
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("Queueing signal %d (idx %d) to thread %d\n",
+      VG_(dmsg)("Queueing signal %d (idx %d) to thread %u\n",
                 si->si_signo, sq->next, tid);
 
    /* Add signal to the queue.  If the queue gets overrun, then old
@@ -2205,7 +2205,7 @@
       least a non-siginfo signal gets deliviered.
    */
    if (sq->sigs[sq->next].si_signo != 0)
-      VG_(umsg)("Signal %d being dropped from thread %d's queue\n",
+      VG_(umsg)("Signal %d being dropped from thread %u's queue\n",
                 sq->sigs[sq->next].si_signo, tid);
 
    sq->sigs[sq->next] = *si;
@@ -2243,7 +2243,7 @@
       if (sq->sigs[idx].si_signo != 0 
           && VG_(sigismember)(set, sq->sigs[idx].si_signo)) {
 	 if (VG_(clo_trace_signals))
-            VG_(dmsg)("Returning queued signal %d (idx %d) for thread %d\n",
+            VG_(dmsg)("Returning queued signal %d (idx %d) for thread %u\n",
                       sq->sigs[idx].si_signo, idx, tid);
 	 ret = &sq->sigs[idx];
 	 goto out;
@@ -2404,7 +2404,7 @@
    info->si_code = sanitize_si_code(info->si_code);
 
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("async signal handler: signal=%d, tid=%d, si_code=%d\n",
+      VG_(dmsg)("async signal handler: signal=%d, tid=%u, si_code=%d\n",
                 sigNo, tid, info->si_code);
 
    /* Update thread state properly.  The signal can only have been
@@ -2513,17 +2513,17 @@
    udelta = VG_PGROUNDUP(seg_next->start - addr);
 
    VG_(debugLog)(1, "signals", 
-                    "extending a stack base 0x%llx down by %lld\n",
-                    (ULong)seg_next->start, (ULong)udelta);
+                    "extending a stack base 0x%lx down by %lu\n",
+                    seg_next->start, udelta);
    Bool overflow;
    if (! VG_(am_extend_into_adjacent_reservation_client)
        ( seg_next->start, -(SSizeT)udelta, &overflow )) {
       Addr new_stack_base = seg_next->start - udelta;
       if (overflow)
-         VG_(umsg)("Stack overflow in thread #%d: can't grow stack to %#lx\n",
+         VG_(umsg)("Stack overflow in thread #%u: can't grow stack to %#lx\n",
                    tid, new_stack_base);
       else
-         VG_(umsg)("Cannot map memory to grow the stack for thread #%d "
+         VG_(umsg)("Cannot map memory to grow the stack for thread #%u "
                    "to %#lx\n", tid, new_stack_base);
       return False;
    }
@@ -2664,11 +2664,11 @@
 
    if (VG_(clo_trace_signals)) {
       if (seg == NULL)
-         VG_(dmsg)("SIGSEGV: si_code=%d faultaddr=%#lx tid=%d ESP=%#lx "
+         VG_(dmsg)("SIGSEGV: si_code=%d faultaddr=%#lx tid=%u ESP=%#lx "
                    "seg=NULL\n",
                    info->si_code, fault, tid, esp);
       else
-         VG_(dmsg)("SIGSEGV: si_code=%d faultaddr=%#lx tid=%d ESP=%#lx "
+         VG_(dmsg)("SIGSEGV: si_code=%d faultaddr=%#lx tid=%u ESP=%#lx "
                    "seg=%#lx-%#lx\n",
                    info->si_code, fault, tid, esp, seg->start, seg->end);
    }
@@ -2752,7 +2752,7 @@
                 "a signal %d (%s) - exiting\n",
                 sigNo, VG_(signame)(sigNo));
 
-      VG_(dmsg)("si_code=%x;  Faulting address: %p;  sp: %#lx\n",
+      VG_(dmsg)("si_code=%d;  Faulting address: %p;  sp: %#lx\n",
                 info->si_code, info->VKI_SIGINFO_si_addr,
                 VG_UCONTEXT_STACK_PTR(uc));
 
@@ -2846,7 +2846,7 @@
    ThreadStatus at_signal = VG_(threads)[tid].status;
 
    if (VG_(clo_trace_signals))
-      VG_(dmsg)("sigvgkill for lwp %d tid %d\n", VG_(gettid)(), tid);
+      VG_(dmsg)("sigvgkill for lwp %d tid %u\n", VG_(gettid)(), tid);
 
    VG_(acquire_BigLock)(tid, "sigvgkill_handler");
 
@@ -2936,7 +2936,7 @@
    /* If there was nothing queued, ask the kernel for a pending signal */
    if (sip == NULL && VG_(sigtimedwait_zero)(&pollset, &si) > 0) {
       if (VG_(clo_trace_signals))
-         VG_(dmsg)("poll_signals: got signal %d for thread %d\n",
+         VG_(dmsg)("poll_signals: got signal %d for thread %u\n",
                    si.si_signo, tid);
       sip = &si;
    }
@@ -2944,7 +2944,7 @@
    if (sip != NULL) {
       /* OK, something to do; deliver it */
       if (VG_(clo_trace_signals))
-         VG_(dmsg)("Polling found signal %d for tid %d\n", sip->si_signo, tid);
+         VG_(dmsg)("Polling found signal %d for tid %u\n", sip->si_signo, tid);
       if (!is_sig_ign(sip, tid))
 	 deliver_signal(tid, sip, NULL);
       else if (VG_(clo_trace_signals))
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 005765a..1471a0b 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -225,7 +225,7 @@
       fp_max -= sizeof(Addr);
 
    if (debug)
-      VG_(printf)("max_n_ips=%d fp_min=0x%08lx fp_max_orig=0x08%lx, "
+      VG_(printf)("max_n_ips=%u fp_min=0x%08lx fp_max_orig=0x08%lx, "
                   "fp_max=0x%08lx ip=0x%08lx fp=0x%08lx\n",
                   max_n_ips, fp_min, fp_max_orig, fp_max,
                   uregs.xip, uregs.xbp);
@@ -518,7 +518,7 @@
       fp_max -= sizeof(Addr);
 
    if (debug)
-      VG_(printf)("max_n_ips=%d fp_min=0x%lx fp_max_orig=0x%lx, "
+      VG_(printf)("max_n_ips=%u fp_min=0x%lx fp_max_orig=0x%lx, "
                   "fp_max=0x%lx ip=0x%lx fp=0x%lx\n",
                   max_n_ips, fp_min, fp_max_orig, fp_max,
                   uregs.xip, uregs.xbp);
@@ -1705,9 +1705,9 @@
    startRegs.r_pc += (Long)(Word)first_ip_delta;
 
    if (0)
-      VG_(printf)("tid %d: stack_highest=0x%08lx ip=0x%010llx "
+      VG_(printf)("tid %u: stack_highest=0x%08lx ip=0x%010llx "
                   "sp=0x%010llx\n",
-		  tid, stack_highest_byte,
+                  tid, stack_highest_byte,
                   startRegs.r_pc, startRegs.r_sp);
 
    return VG_(get_StackTrace_wrk)(tid, ips, max_n_ips, 
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index d277a24..ce93b33 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -1572,9 +1572,10 @@
       Bool ok = VG_(get_fnname_w_offset)(addr, &fnname);
       if (!ok) fnname = "UNKNOWN_FUNCTION";
       VG_(printf)(
-         "==== SB %d (evchecks %lld) [tid %d] 0x%lx %s %s+0x%llx\n",
-         VG_(get_bbs_translated)(), bbs_done, (Int)tid, addr,
-         fnname, objname, (ULong)objoff
+         "==== SB %u (evchecks %llu) [tid %u] 0x%lx %s %s%c0x%lx\n",
+         VG_(get_bbs_translated)(), bbs_done, tid, addr,
+         fnname, objname, objoff >= 0 ? '+' : '-', 
+         (UWord)(objoff >= 0 ? objoff : -objoff)
       );
    }
 
diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c
index a5f6f26..85f9eaa 100644
--- a/coregrind/m_transtab.c
+++ b/coregrind/m_transtab.c
@@ -2373,8 +2373,8 @@
    if (VG_(clo_verbosity) > 2 || VG_(clo_stats)
        || VG_(debugLog_getLevel) () >= 2) {
       VG_(message)(Vg_DebugMsg,
-         "TT/TC: cache: %s--avg-transtab-entry-size=%d, " 
-         "%stool provided default %d\n",
+         "TT/TC: cache: %s--avg-transtab-entry-size=%u, "
+         "%stool provided default %u\n",
          VG_(clo_avg_transtab_entry_size) == 0 ? "ignoring " : "using ",
          VG_(clo_avg_transtab_entry_size),
          VG_(clo_avg_transtab_entry_size) == 0 ? "using " : "ignoring ",
@@ -2426,13 +2426,13 @@
       n_fast_updates, n_fast_flushes );
 
    VG_(message)(Vg_DebugMsg,
-                " transtab: new        %'lld "
+                " transtab: new        %'llu "
                 "(%'llu -> %'llu; ratio %3.1f) [%'llu scs] "
-                "avg tce size %d\n",
+                "avg tce size %llu\n",
                 n_in_count, n_in_osize, n_in_tsize,
                 safe_idiv(n_in_tsize, n_in_osize),
                 n_in_sc_count,
-                (int) (n_in_tsize / (n_in_count ? n_in_count : 1)));
+                n_in_tsize / (n_in_count ? n_in_count : 1));
    VG_(message)(Vg_DebugMsg,
                 " transtab: dumped     %'llu (%'llu -> ?" "?) "
                 "(sectors recycled %'llu)\n",