This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: sizeof() segfault and mutex initialization?
>Here's the "testapplication" used:
>#include <vector>
>
>using namespace std;
>
>int main()
>{
> vector<int> v1;
>
> v1.push_back (1);
>
> return 0;
>}
Here's the smaller example, including a workaround. I just filed a bug
in GNATS about this, and added you to the cc line. You should be getting
email about this shortly.
typedef unsigned int size_t;
extern "C" void *malloc(size_t size);
namespace std
{
template<bool __threads, int __inst>
class __pool_alloc
{
public:
void
_S_chunk_alloc(size_t __size, int& __nobjs);
};
template<bool __threads, int __inst>
void
__pool_alloc<__threads, __inst>::
_S_chunk_alloc(size_t __size, int& __nobjs)
#if 1
// ICE
{ void* foo = malloc(sizeof(int)); }
#else
// Works
{
size_t s = sizeof(int);
void* foo = malloc(s);
}
#endif
}
namespace std
{
template class __pool_alloc<true, 0>;
}