PR middle-end/78605 - bogus -Wformat-length=1 with %f
authorMartin Sebor <msebor@redhat.com>
Fri, 6 Jan 2017 15:45:42 +0000 (15:45 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 6 Jan 2017 15:45:42 +0000 (08:45 -0700)
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr78605.c: New test.

From-SVN: r244164

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr78605.c [new file with mode: 0644]

index 275040cbf590389bf959bdf2e0744ed520f6412a..7ffa070af01c83f4a41d778eb42dc3eab6698c7b 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-06  Martin Sebor  <msebor@redhat.com>
+
+       PR middle-end/78605
+       * gcc.dg/tree-ssa/pr78605.c: New test.
+
 2017-01-05  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/78910
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr78605.c b/gcc/testsuite/gcc.dg/tree-ssa/pr78605.c
new file mode 100644 (file)
index 0000000..1fad314
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/78605 - bogus -Wformat-length=1 with %f
+   { dg-do compile }
+   { dg-options "-O2 -Wall -Wextra -Wformat-length=1" } */
+
+char d[10];
+
+int f (int i)
+{
+  return __builtin_sprintf (d, "%i %i", i, i);
+}
+
+int g (float f)
+{
+  return __builtin_sprintf (d, "%.2f %.2f", f, f);
+}