Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-877

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • External
    • None
    • Incorrect Behavior

    Description

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

      $ 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
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vitek Travis Vitek
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 3h
                  3h