This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13583] New: __use_cache not threadsafe


This fragment in __use_cache (taken from the 3.3 branch) is not threadsafe:

      if (__builtin_expect(!__cache, false))
        {
          __cache = new __locale_cache<_Facet>(__loc);
          __loc._M_impl->_M_install_cache(__cache, __i);
        }

If this code is executed by two threads at the same time, two instances of
the cache are created, of which one will be leaked.

The version on mainline has the same problem.

Since __use_cache first appeard in 3.3.1, this is a regression.

-- 
           Summary: __use_cache not threadsafe
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peturr02 at ru dot is
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]