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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2016-11-22
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot 
gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The test in comment #0 isn't quite right.  The result of the snprintf call
isn't 7 but rather at most 7 so the call cannot be easily eliminated.  The
following is a test case where the call can be, and with the attached patch is,
eliminated.

void f (void)
{
  int n = 7;
  const char *s = "1234567";
  if (n != __builtin_snprintf (0, 0, "%.*s", n, s))
    __builtin_abort ();
}

Reply via email to