On 25.07.2019 02:53, [email protected] wrote:
> From: Christopher Clark <[email protected]>
> 
> gcc 9.1.0 reports:
> 
> | test-cpu-policy.c:64:18: error: '%.12s' directive argument is not a 
> nul-terminated string [-Werror=format-overflow=]
> |    64 |             fail("  Test '%.12s', expected vendor %u, got %u\n",
> |       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | test-cpu-policy.c:20:12: note: in definition of macro 'fail'
> |    20 |     printf(fmt, ##__VA_ARGS__);                 \
> |       |            ^~~
> | test-cpu-policy.c:64:27: note: format string is defined here
> |    64 |             fail("  Test '%.12s', expected vendor %u, got %u\n",
> |       |                           ^~~~~
> | test-cpu-policy.c:44:7: note: referenced argument declared here
> |    44 |     } tests[] = {
> |       |       ^~~~~

In order to possibly create a bug report against gcc I've tried this:

#include <stdio.h>

struct s {
        char ac[12];
        int i;
};

void test(const struct s*ps) {
        printf("'%.12s'\n", ps->ac);
}

There's no warning here. Could you check whether the compiler warns on
that simple test for you? If it does - are we talking about plain
upstream 9.1.0 (in which case I'd be really puzzled by the difference
in behavior)?

Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to