The following snippet of code seg-faults:

typedef 
        std::tr1::unordered_map<
                int,
                char,
                __gnu_cxx::hash<
                        int>,
                std::equal_to<
                        int>,
                std::allocator<
                        std::pair<
                                const int,
                                char> >,
                true> // (*)
        map_t;
        
map_t m;

int i;

for(i = 0; i < 1000; ++i)
        m[i] = 'a';
                
for(i = 0; i < 1000; ++i)
        ++m.find(i)->second;    

  If, however, the value in the line marked with (*) is changed to false (i.e.,
the container does not cache hash values), it runs fine.

g++ --version outputs: g++ (GCC) 4.0.0 20050519 (Red Hat 4.0.0-8)

  Thanks!

-- 
           Summary: tr1::unordered_map seems to seg-fault when caching hash
                    values
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: atavory at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to