diff --git a/src/prof.c b/src/prof.c
--- a/src/prof.c
+++ b/src/prof.c
@@ -1057,25 +1057,25 @@ label_open_close_error:
 		prof_dump_ctx_cleanup(ctx.p, &ctx_ql);
 	malloc_mutex_unlock(&prof_dump_mtx);
 	return (true);
 }
 
 #define	DUMP_FILENAME_BUFSIZE	(PATH_MAX + 1)
 #define	VSEQ_INVALID		UINT64_C(0xffffffffffffffff)
 static void
-prof_dump_filename(char *filename, char v, int64_t vseq)
+prof_dump_filename(char *filename, char v, uint64_t vseq)
 {
 
 	cassert(config_prof);
 
 	if (vseq != VSEQ_INVALID) {
 	        /* "<prefix>.<pid>.<seq>.v<vseq>.heap" */
 		malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
-		    "%s.%d.%"PRIu64".%c%"PRId64".heap",
+		    "%s.%d.%"PRIu64".%c%"PRIu64".heap",
 		    opt_prof_prefix, (int)getpid(), prof_dump_seq, v, vseq);
 	} else {
 	        /* "<prefix>.<pid>.<seq>.<v>.heap" */
 		malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
 		    "%s.%d.%"PRIu64".%c.heap",
 		    opt_prof_prefix, (int)getpid(), prof_dump_seq, v);
 	}
 	prof_dump_seq++;
diff --git a/src/util.c b/src/util.c
--- a/src/util.c
+++ b/src/util.c
@@ -95,17 +95,17 @@ buferror(int err, char *buf, size_t bufl
 	return (strerror_r(err, buf, buflen));
 #endif
 }
 
 uintmax_t
 malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base)
 {
 	uintmax_t ret, digit;
-	int b;
+	unsigned b;
 	bool neg;
 	const char *p, *ns;
 
 	p = nptr;
 	if (base < 0 || base == 1 || base > 36) {
 		ns = p;
 		set_errno(EINVAL);
 		ret = UINTMAX_MAX;
@@ -376,17 +376,19 @@ malloc_vsnprintf(char *str, size_t size,
 		val = va_arg(ap, ssize_t);				\
 		break;							\
 	case 'z' | 0x80:						\
 		val = va_arg(ap, size_t);				\
 		break;							\
 	case 'p': /* Synthetic; used for %p. */				\
 		val = va_arg(ap, uintptr_t);				\
 		break;							\
-	default: not_reached();						\
+	default: 							\
+		not_reached();						\
+		val = 0;						\
 	}								\
 } while (0)
 
 	i = 0;
 	f = format;
 	while (true) {
 		switch (*f) {
 		case '\0': goto label_out;
@@ -543,17 +545,17 @@ malloc_vsnprintf(char *str, size_t size,
 				buf[1] = '\0';
 				APPEND_PADDED_S(buf, 1, width, left_justify);
 				f++;
 				break;
 			} case 's':
 				assert(len == '?' || len == 'l');
 				assert_not_implemented(len != 'l');
 				s = va_arg(ap, char *);
-				slen = (prec < 0) ? strlen(s) : prec;
+				slen = (prec < 0) ? strlen(s) : (size_t)prec;
 				APPEND_PADDED_S(s, slen, width, left_justify);
 				f++;
 				break;
 			case 'p': {
 				uintmax_t val;
 				char buf[X2S_BUFSIZE];
 
 				GET_ARG_NUMERIC(val, 'p');
