This is the mail archive of the cygwin mailing list for the Cygwin 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]

Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.6.0-0.12

> On 2016-08-23 18:56, Corinna Vinschen <> wrote:
> I uploaded a new Cygwin test release 2.6.0-0.12.
> The 2.6.0 release is going to introducing the locale_t datatype, as well
> as all functions related to locale_t locales and per-thread locales per
> POSIX-1.2008.
> So, rather than just providing a single, per-process locale, you can now
> create new locales ("newlocale") and set it as locale for the current
> thread ("uselocale") or use it directly with one of the new functions
> taking a locale_t as parameter (i.e. isalpha_l).
> Since this is brand-new code, this code *will* have bugs.
> It would be very helpful if interested developers and Cygwin package
> maintainers could give this new stuff some good testing.


I have exercised the new locale-related code and think i found a problem
in the strtod_l function (see small test case in gugu.c below).

I use 2.6.0-0.12 under CYGWIN_NT-6.1-WOW.

- the value given in nptr (1.5) has no impact, even an integer value fails
- uncomment the first line in order to silence the warning at compile time
- the problem was originally found in coreutils-8.25: "seq -w 1 10" produces
the same segmentation fault. In order to reproduce this, you must have
coreutils compiled under a recent cygwin1.dll otherwise the strtod_l
part of the coreutils code is not selected.


Denis Excoffier.

% cat gugu.c
//#define _GNU_SOURCE 1
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>

int main() {
  locale_t locale = newlocale (LC_ALL_MASK, "C", (locale_t) 0);
  if (!locale) return 1;
  char const *nptr = "1.5";
  char **endptr;
  double r1 = strtod (nptr, endptr);
  fprintf (stderr, "r1=%f\n", r1);
  double r2 = strtod_l (nptr, endptr, locale);
  fprintf (stderr, "r2=%f\n", r2);
  return 0;
% gcc -O -o gugu gugu.c
gugu.c: In function 'main':
gugu.c:15:15: warning: implicit declaration of function 'strtod_l' [-Wimplicit-function-declaration]
   double r2 = strtod_l (nptr, endptr, locale);
% ./gugu
Segmentation fault (core dumped)
% cat gugu.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=6114F2E8
eax=61213530 ebx=6121B0C0 ecx=6121B0D0 edx=6121B040 esi=00000000 edi=61213440
ebp=0028CC88 esp=0028CB68 program=D:\Users\dexcoff1\dexcoff1\cygscf\gugu.exe, pid 61032, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
0028CC88  6114F2E8 (00000001, 0028CCAC, 80010108, 61007B0A)
0028CD28  61007B6F (00000000, 0028CD84, 61006BA0, 00000000)
End of stack trace
% objdump -d /usr/bin/cygwin1.dll
6114f2d0 <___localeconv_l>:
6114f2d0: 53                    push   %ebx
6114f2d1: 8b 44 24 08           mov    0x8(%esp),%eax
6114f2d5: 8b 88 48 01 00 00     mov    0x148(%eax),%ecx
6114f2db: 8b 90 40 01 00 00     mov    0x140(%eax),%edx
6114f2e1: 05 f0 00 00 00        add    $0xf0,%eax
6114f2e6: 8b 19                 mov    (%ecx),%ebx
6114f2e8: 89 18                 mov    %ebx,(%eax)
6114f2ea: 8b 59 04              mov    0x4(%ecx),%ebx
6114f2ed: 8b 49 08              mov    0x8(%ecx),%ecx
6114f2f0: 89 58 04              mov    %ebx,0x4(%eax)
6114f2f3: 89 48 08              mov    %ecx,0x8(%eax)

Problem reports:
Unsubscribe info:

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