re PR testsuite/86996 (gcc.dg/tree-ssa/builtin-sprintf-warn-1.c FAILs)
authorMartin Sebor <msebor@redhat.com>
Fri, 17 Aug 2018 21:58:27 +0000 (21:58 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 17 Aug 2018 21:58:27 +0000 (15:58 -0600)
PR testsuite/86996

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

From-SVN: r263636

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-1.c

index b8677d7..3478f11 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        * g++.dg/conversion/Wwrite-strings.C: New test.
index 3fb3e6d..a94d123 100644 (file)
@@ -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" } */