https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60336
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0 --- Comment #53 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is a pure C++ testcase that gives the wrong answer in GCC 7, presumably because libc's vsnprintf is expecting the C calling convention. struct foo { }; char buf[128]; int MySnprintf(struct foo, const char *pFormat, ...) { __builtin_va_list arguments; __builtin_va_start(arguments, pFormat); __builtin_vsnprintf(buf, sizeof(buf), pFormat, arguments); __builtin_va_end(arguments); return 0; } int main(void) { struct foo blah; MySnprintf(blah, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); __builtin_puts(buf); } GCC 7 prints: 1:2:3:4:5:4195847:6:7:8:9 GCC 8.1.0 prints: 1:2:3:4:5:6:7:8:9:10