Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

static linking, g++, and setlocale broken



All,
        I'm running 5.99.7.  The behavior of setlocale differs 
between statically and dynamically linked libc.  The 
following C program illustrates the difference:

#include <locale.h>
#include <stdio.h>
int main()
{
        char * l = setlocale (LC_ALL, NULL);
        printf("%s\n", l);
        return 0;
}

Yes, the pointer should be checked before being used.  The 
point here is that the behavior is different between 
statically and dynamically linked programs.  
        C++ compunds the problem.  For example, the following C++ 
program generates a segmentation fault:

#include <iostream>
int main()
{
        float f;
        std::cin >> f;
        return 0;
}

Deep in the STL streams is a call to setlocale where the 
returned value is assumed to be non-null. 
        It appears that the difference in behaviors is in 
_find_category, but I have reached the end of my assembly 
debugging skills.  Any help is appreciated.

Aran

Attachment: signature.asc
Description: This is a digitally signed message part.



Home | Main Index | Thread Index | Old Index