In stage2 of bootstrap-O1, the code that warns if sprintf might
overflow its output buffer cannot tell that an unsigned value narrowed
to 16 bits will fit in 4 bytes with %4x.
Converting the value to 'unsigned short' makes it obvious that it
fits, at least on machines with 16-bit shorts.
for gcc/c-family/ChangeLog
* c-pretty-print.c (pp_c_tree_decl_identifier): Convert 16-bit
value to unsigned short to fit in 4 hex digits without
warnings.
From-SVN: r244121
+2017-01-06 Alexandre Oliva <aoliva@redhat.com>
+
+ * c-pretty-print.c (pp_c_tree_decl_identifier): Convert 16-bit
+ value to unsigned short to fit in 4 hex digits without
+ warnings.
+
2017-01-05 Eric Botcazou <ebotcazou@adacore.com>
* c.opt (fsso-struct): Add 'native' value.
else
{
static char xname[8];
- sprintf (xname, "<U%4x>", ((unsigned)((uintptr_t)(t) & 0xffff)));
+ sprintf (xname, "<U%4hx>", ((unsigned short) ((uintptr_t) (t)
+ & 0xffff)));
name = xname;
}