[Bug locale/23793] New: c32rtomb and mbrtoc32 should not alias wcrtomb and mbrtowc

jsm28 at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu Oct 18 17:01:00 GMT 2018


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

            Bug ID: 23793
           Summary: c32rtomb and mbrtoc32 should not alias wcrtomb and
                    mbrtowc
           Product: glibc
           Version: 2.28
            Status: NEW
          Severity: normal
          Priority: P2
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: jsm28 at gcc dot gnu.org
  Target Milestone: ---

glibc does:

/* There should be no difference between the UTF-32 handling required
   by c32rtomb and the wchar_t handling which has long since been
   implemented in wcrtomb.  */
weak_alias (__wcrtomb, c32rtomb)

/* There should be no difference between the UTF-32 handling required
   by mbrtoc32 and the wchar_t handling which has long since been
   implemented in mbrtowc.  */
weak_alias (__mbrtowc, mbrtoc32)

The reasoning in those comments to justify those aliases is incorrect: ISO C
requires that, for the case of a NULL mbstate_t* being passed, each function
has its *own* internal static mbstate_t.  Thus a program must be able to use
both wcrtomb and c32rtomb at the same time with each keeping its own separate
state, and likewise for mbrtowc and mbrtoc32.  So separate functions are needed
(although they can be trivial wrappers that just pass a pointer to their own
state variable when given a NULL argument).

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


More information about the Glibc-bugs mailing list