[Bug libstdc++/40939] New: unordered_map insertion generates seg fault

2009-08-02 Thread comm_wolf at mail dot ru
Compiler details:
Target: mingw32
Configured with: ../../configure --prefix=/mingw --host=mingw32
--target=mingw32 --program-prefix= --with-as=/mingw/bin/
as.exe --with-ld=/mingw/bin/ld.exe --with-gcc --with-gnu-ld --with-gnu-as
--enable-threads --disable-nls --enable-langua
ges=c,c++ --disable-win32-registry --disable-shared --without-x
--enable-interpreter --enable-hash-synchronization --ena
ble-libstdcxx-debug --with-gmp-include=/projects/common/GMP/4.3.1
--with-gmp-lib=/projects/common/GMP/4.3.1/.libs --with
-mpfr-include=/projects/common/MPFR/2.4.1
--with-mpfr-lib=/projects/common/MPFR/2.4.1/.libs
Thread model: win32
gcc version 4.5.0 20090421 (experimental - lambda branch) (GCC)

Insertion into std::tr1::unordered_map generates segmentation fault. Here is
code sample:

#include 
#include 
#include 
#include 
#include 
#include 

class ABC
{
public:
ABC() : m_A(0) {;}
ABC(int a) : m_A(a) {;}
int A() const {return m_A;}
bool operator ==(ABC const& other) const {return m_A == other.m_A;}
private:
int m_A;

friend std::ostream& operator << (std::ostream& os, ABC const& obj)
{
os << obj.m_A;
return os;
}
};

struct hash_ABC : std::unary_function
{
size_t operator()(ABC const& v) const {return v.A();}
};

int main()
{
typedef std::unordered_map dict_t;

dict_t dic;

ABC key(2);

dic.insert(std::make_pair(ABC(1), std::string("One")));
dic.insert(std::make_pair(key, std::string("Two")));
dic.insert(std::make_pair(ABC(3), std::string("Three")));

return 0;
}

My own investigations were shown what problem is within _M_allocate_node
function (include\c++\tr1_impl\hashtable, line #477). When I removed
__try/__catch block from this function all start work fine. In the original
case this function returns strange value (sometimes NULL, sometimes garbage).


-- 
   Summary: unordered_map insertion generates seg fault
   Product: gcc
   Version: 4.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: comm_wolf at mail dot ru
 GCC build triplet: i386-pc-mingw
  GCC host triplet: i386-pc-mingw
GCC target triplet: i386-pc-mingw


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40939



[Bug libstdc++/40939] unordered_map insertion generates seg fault

2009-08-02 Thread comm_wolf at mail dot ru


--- Comment #1 from comm_wolf at mail dot ru  2009-08-02 11:04 ---
Created an attachment (id=18285)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18285&action=view)
Preprocessed sample source file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40939



[Bug libstdc++/40939] unordered_map insertion generates seg fault

2009-08-02 Thread comm_wolf at mail dot ru


--- Comment #3 from comm_wolf at mail dot ru  2009-08-02 11:38 ---
Ok. I'll try it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40939



[Bug libstdc++/40939] unordered_map insertion generates seg fault

2009-08-02 Thread comm_wolf at mail dot ru


--- Comment #5 from comm_wolf at mail dot ru  2009-08-02 17:52 ---
Thanks for your advise.

After gcc recompilation (according to the currently trunk state) error was
disappeared. It seems like there is a bug in 'lambda' branch sources.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40939