This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #130530]: HP-UX assertion failure
authorKarl Williamson <khw@cpan.org>
Mon, 9 Jan 2017 22:40:54 +0000 (15:40 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 11 Jan 2017 21:57:06 +0000 (14:57 -0700)
This was introduced in a1a5ec35e6a3df0994b103aadb28a8c1a3a278da, and was
due to a thinko on my part.  Zefram figured it out.

A macro evaluating to a string constant returns an instance of that
constant.  Compilers are free to collapse all instances into a single
one (which saves space), or to have multiple copies.  The code was
assuming the former, and HP-UX cc doesn't.

The passed size also was one byte larger than it should have been.

regcomp.c

index 2e7999f..7b80108 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -10044,11 +10044,10 @@ Perl__load_PL_utf8_foldclosures (pTHX)
      * to force that */
     if (! PL_utf8_tofold) {
         U8 dummy[UTF8_MAXBYTES_CASE+1];
+        const U8 hyphen[] = HYPHEN_UTF8;
 
         /* This string is just a short named one above \xff */
-        toFOLD_utf8_safe((U8*) HYPHEN_UTF8,
-                         (U8 *) HYPHEN_UTF8 + sizeof(HYPHEN_UTF8),
-                         dummy, NULL);
+        toFOLD_utf8_safe(hyphen, hyphen + sizeof(hyphen) - 1, dummy, NULL);
         assert(PL_utf8_tofold); /* Verify that worked */
     }
     PL_utf8_foldclosures = _swash_inversion_hash(PL_utf8_tofold);