This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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 libc/11828] New: spurious hi-word part in nl_langinfo on 64bit platform


Hello,

I am calling nl_langinfo (_NL_TIME_WEEK_1STDAY); which is supposed to
return an integer like 19971130, but I am getting 0x888888880130bc3a,
i.e. (0x8888888800000000 | 19971130). Looking at __nl_langinfo_l code,
I can see:

return (char *) data->values[index].string;

where string is member of 

  union locale_data_value
  {
    const uint32_t *wstr;
    const char *string;
    unsigned int word;          /* Note endian issues vs 64-bit pointers.  */
  }

and indeed I can read

locale/categories.def:  DEFINE_ELEMENT (_NL_TIME_WEEK_1STDAY,     "week-1stday",         std, word)

I guess maybe the union gets loaded through the word member only, thus
leaving the higher part of the string member uninitialized?  Note that
I am using MALLOC_PERTURB_=$RANDOM, without it the problem disappears.

-- 
           Summary: spurious hi-word part in nl_langinfo on 64bit platform
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: samuel dot thibault at ens-lyon dot org
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gun


http://sourceware.org/bugzilla/show_bug.cgi?id=11828

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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