Message ID | yddh98g38m7.fsf@CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
> No worries: I've refreshed your patch on top of Thomas Preud'homme's for > PR testsuite/77710 and found that one more bit is needed to fix this > completely. 32-bit Solaris shows three more warnings: > > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c:1355:3: warning: format '%lc' expects argument of type 'wint_t', but argument 6 has type 'int' [-Wformat=] > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c:1356:3: warning: format '%lc' expects argument of type 'wint_t', but argument 6 has type 'int' [-Wformat=] > /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c:1357:3: warning: format '%lc' expects argument of type 'wint_t', but argument 6 has type 'int' [-Wformat=] Rats! I overlooked those in followup patch I committed to fix the others. I had tested the change with a 32-bit cross compiler but I still see them in the 32-bit Solaris cross compiler, though not in the i366 one. I assumed the i386 compiler was a good enough proxy but now that I've checked more carefully I see that it warns for %lc with a wchar_t argument such as L'a' but not for int such as 0, while the 32-bit Solaris compiler for %lc with an int argument and not for wchar_t. In the i386 compiler wchar_t is long and wint_t is unsigned int while in the Solaris one both wchar_t and wint_t are long int. Even though these types and arguments are the same width (and on Solaris even the same sign), -Wformat still warns. I've fixed fix this in the test in r241123. Since I didn't manage to convince Joseph that the warning is unhelpful in our discussion last week I wasn't going to pursue it but I've now changed my mind. The warning is obviously detrimental to portability so I've raised bug 77970 for it. Thanks Martin > > Fixed as follows: > > > > > With this one and your refreshed patch, all failures are gone now for > i386-pc-solaris2.12, sparc-sun-solaris2.12, and x86_64-pc-linux-gnu. > > Rainer >
# HG changeset patch # Parent 1aaf616a61b8ea3ecff9313e059a1e85571cdde1 [testsuite] Fix 32-bit gcc.dg/tree-ssa/builtin-sprintf-warn-1.c on Solaris diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c @@ -1352,9 +1352,9 @@ void test_snprintf_chk_c_const (void) T (3, "%c_%c", '1', '2'); /* { dg-warning "output truncated" } */ /* Wide characters. */ - T (0, "%lc", 0); - T (1, "%lc", 0); - T (2, "%lc", 0); + T (0, "%lc", (wint_t)0); + T (1, "%lc", (wint_t)0); + T (2, "%lc", (wint_t)0); /* The following could result in as few as a single byte and in as many as MB_CUR_MAX, but since the MB_CUR_MAX value is a runtime property