[LLVMbugs] [Bug 19979] New: raw_string_ostream doesn't set unbuffered

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jun 8 17:22:39 PDT 2014


            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: unassignedbugs at nondot.org
          Reporter: robeypointer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140609/7230b014/attachment.html>

More information about the llvm-bugs mailing list