http://llvm.org/bugs/show_bug.cgi?id=19979

            Bug ID: 19979
           Summary: raw_string_ostream doesn't set unbuffered
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Core LLVM classes
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

sorry if i got the component wrong. the bug is in Support/raw_ostream.h.

raw_string_ostream subclasses raw_ostream, but doesn't pass any value for the
"unbuffered" constructor field. the default is false (or buffered). but no
buffer is ever allocated because raw_string_ostream is a wrapper for a
std::string.

attempting to work around this bug will always end up in a codepath that tries
to delete[] the null buffer, and then sad faces all around.

the fix is simple. around line 441, this:

  explicit raw_string_ostream(std::string &O) : OS(O) {}

should be this:

  explicit raw_string_ostream(std::string &O) : raw_ostream(true), OS(O) {}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to