This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure - test that gcvt/qgcvt are not buggy (Issue 18170)
authorsisyphus <sisyphus@cpan.org>
Tue, 20 Oct 2020 23:52:11 +0000 (10:52 +1100)
committerKarl Williamson <khw@cpan.org>
Sun, 27 Dec 2020 19:09:06 +0000 (12:09 -0700)
Configure

index 90ea4bd..2d2f22f 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -10374,6 +10374,15 @@ void checkit(const char *expect, char *got)
        }
 }
 
+void lencheck(int expect, int got)
+{
+    if (expect != got) {
+               printf("%s length mismatch:  Expected %d, got %d\n",
+                       myname, expect, got);
+               exit(1);
+        }
+}
+
 int main()
 {
        char buf[64];
@@ -10446,6 +10455,12 @@ int main()
        else
            checkit("1e+34", buf);
 
+        /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
+         * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
+
+       Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
+       lencheck(55, (int)strlen(buf));
+
        /* For Perl, if you add additional tests here, also add them to
         * t/base/num.t for benefit of platforms not using Configure or
         * overriding d_Gconvert */