[AIX] SIGABRT when using strftime() after enumerating locales
-------------------------------------------------------------

                 Key: STDCXX-877
                 URL: https://issues.apache.org/jira/browse/STDCXX-877
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
            Reporter: Travis Vitek


Here is the input program, the compile line and the output.

{noformat}
$ cat t.cpp && xlC -g t.cpp -o ./t && ./t
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int main (int, char**)
{
    FILE* pipe = popen ("locale -a", "r");
    if (!pipe)
        return 1;

    char buf [128];
    while (fgets (buf, sizeof (buf), pipe)) {

        const size_t len = strlen (buf);
        buf [len ? len - 1 : 0] = '\0';

        setlocale (LC_CTYPE, buf);
    }

    pclose (pipe);

    if (!setlocale (LC_ALL, "EN_US"))
        return 2;

    const time_t t = time (0);
    const tm *ptm = localtime (&t);

    strftime (buf, sizeof buf, "%Y", ptm);

    return 0;
}
Segmentation fault (core dumped)

$ dbx ./t
Type 'help' for help.
warning: The core file is not a fullcore. Some info may
not be available.
[using memory image in core]
reading symbolic information ...

Segmentation fault in __xisdigit at 0xd033cc08
0xd033cc08 (__xisdigit+0x1c) 80650134        lwz   r3,0x134(r5)
(dbx) where
__xisdigit(0x28165874, 0x59) at 0xd033cc08
doformat(??, ??, ??, ??, ??, ??, ??, ??) at 0xd0338660
__strftime_std(??, ??, ??, ??, ??, ??, ??, ??) at 0xd0338464
strftime(??, ??, ??, ??) at 0xd0341c48
main( = 1,  = 0x2ff22ac4), line 29 in "t.cpp"
(dbx) quit
{noformat}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to