newlocale(3) appears to be broken?
Steve Kargl
sgk at troutmask.apl.washington.edu
Thu Apr 23 18:29:21 UTC 2015
It appears that newlocale(3) is broken.
First, the manpage indicates that one
needs to use
#include <xlocale>
which leads to
troutmask:sgk[204] cc -o z r.c
r.c:1:10: fatal error: 'xlocale' file not found
#include <xlocale>
^
1 error generated.
next the manpage says
STANDARDS
This function conforms to IEEE Std 1003.1-2008 (``POSIX.1'').
However, http://pubs.opengroup.org/stage7tc1/functions/newlocale.html
says newlocale is declared in locale.h.
Now consider
% cat r.c
#include <locale.h>
int
main(void)
{
locale_t a;
a = newlocale(0, "C", 0);
if (a)
return 0;
else
return 1;
}
troutmask:sgk[206] cc -o z -static r.c && ./z
Segmentation fault (core dumped)
troutmask:sgk[206] cc -o z -static r.c && ./z
Segmentation fault (core dumped)
troutmask:sgk[207] gdb782 z z.core
[New process 100313]
Core was generated by `z'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000415798 in newlocale ()
(gdb) bt
#0 0x0000000000415798 in newlocale ()
#1 0x0000000000400434 in main ()
--
Steve
More information about the freebsd-standards
mailing list