This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix above-Unicode UTF-8 detection for EBCDIC
authorKarl Williamson <khw@cpan.org>
Tue, 13 Dec 2016 17:35:39 +0000 (10:35 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 13 Dec 2016 18:35:37 +0000 (11:35 -0700)
The root cause of this was missing parentheses causing (s[0] + 1) to be
evaluated instead of the desired s[1].  It was causing an error in
lib/warnings.t, but only on EBCDIC platforms.

utf8.h

diff --git a/utf8.h b/utf8.h
index 4b51450..f6d9d54 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -830,7 +830,7 @@ fit in an IV on the current machine.
                   ((    LIKELY((e) > (s) + 4)                               \
                     &&      NATIVE_UTF8_TO_I8(*(s)) >= 0xF9                 \
                     && (    NATIVE_UTF8_TO_I8(*(s)) >  0xF9                 \
-                        || (NATIVE_UTF8_TO_I8(*(s) + 1) >= 0xA2))           \
+                        || (NATIVE_UTF8_TO_I8(*((s) + 1)) >= 0xA2))         \
                     &&  LIKELY((s) + UTF8SKIP(s) <= (e)))                   \
                     ? _is_utf8_char_helper(s, s + UTF8SKIP(s), 0) : 0)
 #else