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

            Bug ID: 85418
           Summary: -Wformat-truncation on inlinned function
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Azim.Khan at arm dot com
  Target Milestone: ---

See following code:

```
#include <stdio.h>

void f(const char s[5], size_t len)
{
    char b[5];
    snprintf(b, len, "%s", s); 
}

int main()
{
    f("Hello World", 4); 
    return 0;
}
```

On compiling it with -O2/3 f() gets inlinned and snprintf format checks apply
to it even though parameters to snprintf are parameters within f().

Reply via email to