This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
PATCH (libstdc++-v3): abort/segfault in CVS main
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- To: libstdc++ at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Feb 2004 18:58:11 -0600 (CST)
- Subject: PATCH (libstdc++-v3): abort/segfault in CVS main
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
Stefan wrote:
> I might have a complete meltdown this late friday and miss the obvious,
> but after the recent changes to mt allocator (interface to allocate etc)
> my simple testapplication (see attached file) does not work anymore: [...]
Based on your final observations (in your second followup), I have
pieced it together. (While forming this patch, you fixed the root
problem in mt_allocator.h as a side-effect. I also checked all other
currently installed headers for this issue.)
It is an absolute requirement that all library headers, which may be
included directly by a user, themselves include c++config.h (or
another file known to do so) before attempting to use any other
"internal headers" which need said configuration. I conclude this
problem occurred when the pool allocator was moved from bits to ext.
Then your allocator was reworked into the same form. Since we have no
automatic check, an easy thing to overlook (I would have).
> well I have found what's causing the abort/segfault at least:
> __GTHREADS is not defined even though the compiler has posix support
> and I compile with -pthread flag.
FYI, since ~gcc 3, -pthread affects no libstdc++-v3 macros (it may
affect macros for the system libc and link libraries).
Commited to mainline as obvious. Likely, both
ext/{mt,pool}_allocator.h are broken on 3.4 as well.
Regards,
Loren
* include/ext/pool_allocator.h: Include c++config.h.
Index: libstdc++-v3/include/ext/pool_allocator.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/ext/pool_allocator.h,v
retrieving revision 1.9
diff -c -r1.9 pool_allocator.h
*** libstdc++-v3/include/ext/pool_allocator.h 4 Feb 2004 17:37:10 -0000 1.9
--- libstdc++-v3/include/ext/pool_allocator.h 10 Feb 2004 00:10:15 -0000
***************
*** 47,52 ****
--- 47,53 ----
#ifndef _POOL_ALLOCATOR_H
#define _POOL_ALLOCATOR_H 1
+ #include <bits/c++config.h>
#include <new>
#include <bits/functexcept.h>
#include <bits/stl_threads.h>