diff --git a/misc/Makefile b/misc/Makefile
index b7be2bc19a..eb77b87b0d 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -89,11 +89,20 @@ tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
 tests-internal := tst-atomic tst-atomic-long tst-allocate_once
 tests-static := tst-empty
 
+tests-internal += tst-ldbl-warn
+
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-error1-mem.out \
   $(objpfx)tst-allocate_once-mem.out
+
+tests-special += $(objpfx)tst-ldbl-warn.out
 endif
 
+$(objpfx)tst-ldbl-warn.out: \
+  tst-ldbl-warn.sh $(objpfx)tst-ldbl-warn
+	$(SHELL) $^ '$(test-program-prefix)' $@; \
+	$(evaluate-test)
+
 CFLAGS-select.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tsearch.c += $(uses-callbacks)
 CFLAGS-lsearch.c += $(uses-callbacks)
diff --git a/misc/tst-ldbl-warn.c b/misc/tst-ldbl-warn.c
new file mode 100644
index 0000000000..db771b5c59
--- /dev/null
+++ b/misc/tst-ldbl-warn.c
@@ -0,0 +1,61 @@
+/* Test for the long double conversions in *warn* functions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <err.h>
+#include <stdarg.h>
+
+#include <support/check.h>
+
+static void
+do_test_call_varg (const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  vwarn (format, args);
+  va_end (args);
+
+  va_start (args, format);
+  vwarnx (format, args);
+  va_end (args);
+}
+
+static void
+do_test_call_rarg (const char *format, long double ld1, double d1,
+		   long double ld2, double d2)
+{
+  warn (format, ld1, d1, ld2, d2);
+  warnx (format, ld1, d1, ld2, d2);
+}
+
+static int
+do_test (void)
+{
+  double d1 = -2;
+  double d2 = -4;
+  long double ld1 = -1;
+  long double ld2 = -3;
+
+  /* Print in decimal notation.  */
+  do_test_call_rarg ("%Lf - %f - %Lf - %f", ld1, d1, ld2, d2);
+  do_test_call_varg ("%Lf - %f - %Lf - %f", ld1, d1, ld2, d2);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/misc/tst-ldbl-warn.sh b/misc/tst-ldbl-warn.sh
new file mode 100644
index 0000000000..5827be9dbe
--- /dev/null
+++ b/misc/tst-ldbl-warn.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Test for the long double conversions in *warn* functions.
+# Copyright (C) 2018 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+  ${test_program} \
+  2> ${test_program_output} || status=1
+
+# Remove the program name from the output, because checking the program
+# name is out of the scope of this test case.
+sed -i "s/.*tst-[^:]*: //" ${test_program_output}
+
+cat <<'EOF' |
+-1.000000 - -2.000000 - -3.000000 - -4.000000: Success
+-1.000000 - -2.000000 - -3.000000 - -4.000000
+-1.000000 - -2.000000 - -3.000000 - -4.000000: Success
+-1.000000 - -2.000000 - -3.000000 - -4.000000
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+  status=1
+  echo "*** output comparison failed"
+}
+
+exit $status
