[forwarded from http://bugs.debian.org/343108]

4.0 branch 20051204, 4.1 20051124

The following code segfaults. Looks like a double delete,
_S_destroy_c_locale() being called twice: first in the regular path of
codecvt.h:codecvt_byname ctor, then a second time when ~codecvt() is
automatically called to clean up the inherited class.


#include <iostream>
#include <stdexcept>

typedef std::codecvt_byname<wchar_t, char, mbstate_t> cvt_byname_t;

int main()
{
  cvt_byname_t *cvt;
  char name[] = "invalid-loc";
  try {
     cvt = new cvt_byname_t(name);
   } catch (const std::runtime_error& re) {
     std::cerr << "successfully catched misnamed locale" << std::endl;
   }
}


-- 
           Summary: catching exception from codecvt_byname() segfaults
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org


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

Reply via email to