https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78901

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 40407
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40407&action=edit
gcc7-pr78901-1.patch

Untested fix.  With this snprintf in -std=c++11 and above will be actually
noexcept even if badly declared.  But with -std=c++98 snprintf should not be
recognized as a builtin.

The gimple-ssa-sprintf.c changes will be still needed, because:
extern "C" int __snprintf_chk (char *, __SIZE_TYPE__, int, __SIZE_TYPE__, const
char *, ...);

int foo (char *c)
{
  try {
    return __snprintf_chk (c, 64, 0, 32, "%s", "abcdefghijklmnopq");
  } catch (...) { }
}
still ICEs in -std=gnu++14 -O2 mode.  That function and other *_chk ones aren't
part of C89/C99/C11 and so if they aren't properly declared noexcept or
nothrow(), we have to consider they might throw.

Reply via email to