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

--- Comment #2 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> ---
Sometimes actual location is not reported at all:

[code]
#include <stdio.h>
#include <string.h>

struct S
{
    char* str;
    int n;
    char out[10];
};

void test(S* s)
{
    if (s->str)
        snprintf(s->out, sizeof(s->out), "%d", s->n);
    else
        snprintf(s->out, sizeof(s->out), ".%s", s->str);
}
[/code]

[out]
test.cc: In function ‘void test(S*)’:
test.cc:11:6: warning: ‘%s’ directive argument is null [-Wformat-truncation=]
 void test(S* s)
      ^~~~
[/out]

Reply via email to