From: Martin Sebor Date: Fri, 17 Aug 2018 21:58:27 +0000 (+0000) Subject: re PR testsuite/86996 (gcc.dg/tree-ssa/builtin-sprintf-warn-1.c FAILs) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f0821f4468b774cefe0a00560ed4bd290835fe2;p=gcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8677d729bc..3478f11b17b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-17 Martin Sebor + + PR testsuite/86996 + * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Adjust. + 2018-08-17 David Malcolm * g++.dg/conversion/Wwrite-strings.C: New test. 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 index 3fb3e6df592..a94d123b34c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c @@ -1558,9 +1558,10 @@ void test_snprintf_c_const (char *d) T (3, "%lc%c", (wint_t)'1', '2'); /* 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 - nul), but the likely number is 3 (plus the nul). */ - 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" } */ + so the output range is [0, 2, 6, 6] with the middle being used for + the diagnostic (and the extremes for optimization). The cast is + 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'. */ 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" } */