[cfe-dev] Regex/locale libcxx test failure on FreeBSD

Krzysztof Parzyszek via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 18 05:35:44 PDT 2016


There are a few failures related to locales. All these tests "pass" 
(i.e. don't fail) on my Ubuntu, but that's likely because it doesn't 
have the extra locales installed.
I'll try to go the second route (i.e. patch), but I need to sift through 
the failures first.

-Krzysztof

On 10/15/2016 3:38 PM, Eric Fiselier wrote:
> Please file a bug or submit a patch.
>
> /Eric
>
> On Fri, Oct 14, 2016 at 6:38 PM, Krzysztof Parzyszek via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>
>     The test is
>     projects/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp
>
>     This assertion fails on FreeBSD:
>
>         std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
>         {
>             std::cmatch m;
>             const char s[] = "m";
>             assert(std::regex_match(s, m, std::regex("[a[=M=]z]",
>                                     std::regex_constants::basic)));
>
>
>     From the looks of it, "m" should not match "[=M=]".  M is not a
>     special letter in Czech, as far as I know, and the match is
>     case-sensitive.
>
>     Libc seems to agree with this:
>
>     --- t.c ---
>     #include <locale.h>
>     #include <stdio.h>
>     #include <regex.h>
>
>     char errbuf[1024];
>
>     int main() {
>       int r;
>       regex_t re;
>       regmatch_t m;
>
>       setlocale(LC_COLLATE, "cs_CZ.ISO8859_2");
>
>       r = regcomp(&re, "[a[=M=]z]", REG_BASIC);
>       printf("regcomp=%d\n", r);
>
>       r = regexec(&re, "m", 0, &m, 0);
>       printf("regexec=%d\n", r);
>
>       if (r != 0) {
>         regerror(r, &re, errbuf, 1023);
>         printf("error: %s\n", errbuf);
>       }
>     }
>     -----------
>
>     clang t.c
>     ./a.out
>
>     regcomp=0
>     regexec=1
>     error: regexec() failed to match
>
>
>     If the string in t.c is "M", it matches.
>
>     -Krzysztof
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>     <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the cfe-dev mailing list