in Mac os x 10.3.9, I get warnings about "invalid or double free" from the 
following piece of code when 
compiled at at least -O1. I believe this code to be valid by the standard. Due 
to time constraints for a 
couple of weeks I'm not going to be able to investigate more carefully what is 
causing this problem, and 
in particular if it's libstdc++, g++ or the apple malloc checker's fault. Sorry.

#include <new>
#include <string>
#include <stdexcept>

void test01(void)
{
  int csz01;

  const char str_lit01[] = "rodeo beach, marin";
  std::string str01(str_lit01);
  csz01 = str01.size();
  std::string str03(str01,csz01);
}

int main()
{ 
  test01();
  return 0;
}

-- 
           Summary: Invalid free in std::string
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris at bubblescope dot net
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: apple-ppc-darwin


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

Reply via email to