https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108159
Bug ID: 108159 Summary: gcc.dg/format/ms-format2.c fails due to warning message change Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: testsuite Assignee: unassigned at gcc dot gnu.org Reporter: nightstrike at gmail dot com Target Milestone: --- This is presumably a regression, as the test worked when it first went in. However, the warning message being tested for has since changed the line that gets reported: printf (XXX, p); /* { dg-warning "format" "bad argument types" } */ printf ("%I32x", f); /* { dg-warning "format" "bad argument types" } */ printf ("%I64x", d); /* { dg-warning "format" "bad argument types" } */ gcc.dg/format/ms-format2.c: In function 'foo': gcc.dg/format/ms-format2.c:12:13: warning: format '%I64x' expects argument of type 'long long unsigned int', but argument 2 has type 'void *' [-Wformat=] gcc.dg/format/ms-format2.c:20:11: note: in expansion of macro 'XXX' gcc.dg/format/ms-format2.c:12:18: note: format string is defined here gcc.dg/format/ms-format2.c:21:16: warning: format '%I32x' expects argument of type 'long unsigned int', but argument 2 has type 'double' [-Wformat=] gcc.dg/format/ms-format2.c:22:16: warning: format '%I64x' expects argument of type 'long long unsigned int', but argument 2 has type 'double' [-Wformat=] FAIL: gcc.dg/format/ms-format2.c -DWIDE bad argument types (test for warnings, line 20) PASS: gcc.dg/format/ms-format2.c -DWIDE bad argument types (test for warnings, line 21) PASS: gcc.dg/format/ms-format2.c -DWIDE bad argument types (test for warnings, line 22) FAIL: gcc.dg/format/ms-format2.c -DWIDE (test for excess errors) Excess errors: gcc.dg/format/ms-format2.c:12:13: warning: format '%I64x' expects argument of type 'long long unsigned int', but argument 2 has type 'void *' [-Wformat=] I assume the fix is to move the dg-warning to the macro definition line, but I don't know how to distinguish between the 32 and 64-bit cases in dejagnu. To be clear, the following change makes the test work for the 64-bit case: diff --git a/gcc/testsuite/gcc.dg/format/ms-format2.c b/gcc/testsuite/gcc.dg/format/ms-format2.c index 5c950522a7c..e56bfc4a9c4 100644 --- a/gcc/testsuite/gcc.dg/format/ms-format2.c +++ b/gcc/testsuite/gcc.dg/format/ms-format2.c @@ -9,7 +9,7 @@ #include "format.h" #ifdef _WIN64 -#define XXX "%I64x" +#define XXX "%I64x" /* { dg-warning "format" "bad argument types" } */ #else #define XXX "%I32x" #endif @@ -17,7 +17,7 @@ void foo (float f, double d, void *p) { - printf (XXX, p); /* { dg-warning "format" "bad argument types" } */ + printf (XXX, p); printf ("%I32x", f); /* { dg-warning "format" "bad argument types" } */ printf ("%I64x", d); /* { dg-warning "format" "bad argument types" } */ } But that won't address the 32-bit case. I suppose there's some other "{}" thing to put on both #define XXX lines to choose which architecture, but I don't know what that would be. Hopefully this is enough diagnosis for someone more knowledgeable to pick it up and run with it.