gcc/ChangeLog:
PR c++/81586
* pretty-print.c (pp_format): Correct the handling of %s precision.
From-SVN: r251029
+2017-08-10 Martin Sebor <msebor@redhat.com>
+
+ PR c++/81586
+ * pretty-print.c (pp_format): Correct the handling of %s precision.
+
2017-08-10 H.J. Lu <hongjiu.lu@intel.com>
PR target/81736
}
s = va_arg (*text->args_ptr, const char *);
- pp_append_text (pp, s, s + n);
+
+ /* Negative precision is treated as if it were omitted. */
+ if (n < 0)
+ n = INT_MAX;
+
+ /* Append the lesser of precision and strlen (s) characters. */
+ size_t len = strlen (s);
+ if ((unsigned) n < len)
+ len = n;
+
+ pp_append_text (pp, s, s + len);
}
break;