ref: 8a12777187779837b55e84a8cae473f2b41527cd
parent: 6b911721fbe864d1966a471c6b0f111ea5083aaf
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Jul 22 14:13:13 EDT 2015
Fix printf alike format strings Pointer substraction generates ptrdiff_t values, which maybe are equal to int or maybe no. In this case we now for sure the values will smaller than 32768, so we can safely cast it to int. Thanks to pancake who reported it!
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -284,7 +284,7 @@
break;
}
if (argp != &args[nargs]) {
- sprintf(yytext, "@%02d@", argp - args);
+ sprintf(yytext, "@%02d@", (int) (argp - args));
ispar = 1;
}
}
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -27,7 +27,7 @@
for (bp = htab; bp < &htab[NR_SYM_HASH]; ++bp) {
if (*bp == NULL)
continue;
- fprintf(stderr, "%d", bp - htab);
+ fprintf(stderr, "%d", (int) (bp - htab));
for (sym = *bp; sym; sym = sym->hash)
fprintf(stderr, "->%d:%s", sym->ns, sym->name);
putc('\n', stderr);