This is the mail archive of the libc-locales@sourceware.org mailing list for the GNU libc locales project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug localedata/18589] sort-test.sh fails at random


https://sourceware.org/bugzilla/show_bug.cgi?id=18589

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
This is a regression from 2.21, caused by:

commit f13c2a8dff2329c6692a80176262ceaaf8a6f74e
Author: Leonhard Holz <leonhard.holz@web.de>
Date:   Tue May 12 11:37:52 2015 +0200

    Improve strcoll with strdiff.

    This patch improves strcoll hot case by finding first byte that
    mismatches. That is in likely case enough to determine comparison
    result.

sort-test.sh is randomized.  The following deterministic test reproduces this
reliably.  Note that AA should be treated as the last letter of the Danish
alphabet, hence sorting after AS.

#include <locale.h>
#include <stdio.h>
#include <string.h>

int
main (void)
{
  if (setlocale (LC_ALL, "da_DK.ISO-8859-1") == NULL)
    {
      perror ("setlocale");
      return 1;
    }
  int a = strcoll ("AS", "AA");
  int b = strcoll ("AA", "AS");
  printf ("strcoll (\"AS\", \"AA\") = %d\n", a);
  printf ("strcoll (\"AA\", \"AS\") = %d\n", b);
  if (a < 0 && b > 0)
    {
      puts ("PASS");
      return 0;
    }
  else
    {
      puts ("FAIL");
      return 1;
    }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]