RFA: Update swfprintf.c test for 32-bit double targets

Nick Clifton nickc@redhat.com
Tue Mar 10 17:12:00 GMT 2015

Hi Jeff, Hi Corinna,

  The newlib testcase swfprintf.c is failing to compile for the RX
  target (amoungst others) because of this warning:

    newlib/testsuite/newlib.stdio/swprintf.c:21:3: warning:
      floating constant exceeds range of 'double' [-Woverflow]

  The following patch fixes this problem by just reducing the size of
  the constant.  As far as I can see this does not invalidate the test
  since all it cares about is whether the double value printed as
  narrow characters matches the same value printed as wide characters.
  The actual value used does not matter.

  OK to apply ?


Index: newlib/testsuite/newlib.stdio/swprintf.c
RCS file: /cvs/src/src/newlib/testsuite/newlib.stdio/swprintf.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 swprintf.c
--- newlib/testsuite/newlib.stdio/swprintf.c	15 Jul 2011 17:20:16 -0000	1.1
+++ newlib/testsuite/newlib.stdio/swprintf.c	10 Mar 2015 17:02:55 -0000
@@ -18,7 +18,7 @@ int main()
   char cbuf[512];
   wchar_t wcbuf[512], wcbuf2[512];
-  double val = 1E+308;
+  double val = 1E+30;
   snprintf(cbuf, 512, "%.*f", 3, val);
   swprintf(wcbuf, 512, L"%.*f", 3, val);
   mbstowcs(wcbuf2, cbuf, 512);

More information about the Newlib mailing list