Commit 6f0821f4 by Martin Sebor Committed by Martin Sebor

re PR testsuite/86996 (gcc.dg/tree-ssa/builtin-sprintf-warn-1.c FAILs)

PR testsuite/86996

gcc/testsuite/CHangeLog:
	* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.

From-SVN: r263636
parent 505ce5ab
2018-08-17 Martin Sebor <msebor@redhat.com>
PR testsuite/86996
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust.
2018-08-17 David Malcolm <dmalcolm@redhat.com> 2018-08-17 David Malcolm <dmalcolm@redhat.com>
* g++.dg/conversion/Wwrite-strings.C: New test. * g++.dg/conversion/Wwrite-strings.C: New test.
......
...@@ -1558,9 +1558,10 @@ void test_snprintf_c_const (char *d) ...@@ -1558,9 +1558,10 @@ void test_snprintf_c_const (char *d)
T (3, "%lc%c", (wint_t)'1', '2'); T (3, "%lc%c", (wint_t)'1', '2');
/* Here %lc may result in anywhere between 0 and MB_CUR_MAX characters /* Here %lc may result in anywhere between 0 and MB_CUR_MAX characters
so the minimum number of bytes on output is 2 (plus the terminating so the output range is [0, 2, 6, 6] with the middle being used for
nul), but the likely number is 3 (plus the nul). */ the diagnostic (and the extremes for optimization). The cast is
T (3, "%lc%c%c", (wint_t)'\x80', '2', '3'); /* { dg-warning ".%c. directive output may be truncated writing 1 byte into a region of size between 0 and 2" } */ to prevent sign extension. */
T (3, "%lc%c%c", (wint_t)(unsigned char)'\x80', '2', '3'); /* { dg-warning ".%c. directive output may be truncated writing 1 byte into a region of size between 0 and 2" } */
/* It's reasonably safe that L'1' converts into the single byte '1'. */ /* It's reasonably safe that L'1' converts into the single byte '1'. */
T (3, "%lc%c%c", (wint_t)'1', '2', '3'); /* { dg-warning "output may be truncated" } */ T (3, "%lc%c%c", (wint_t)'1', '2', '3'); /* { dg-warning "output may be truncated" } */
T (3, "%lc%lc%c", (wint_t)'1', (wint_t)'2', '3'); /* { dg-warning "output may be truncated" } */ T (3, "%lc%lc%c", (wint_t)'1', (wint_t)'2', '3'); /* { dg-warning "output may be truncated" } */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment