[LLVMbugs] [Bug 13526] New: LLVM::Triple code called by LLVMWriteBitcodeToFile segfaults

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 4 20:30:33 PDT 2012


             Bug #: 13526
           Summary: LLVM::Triple code called by LLVMWriteBitcodeToFile
           Product: libraries
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Bitcode Writer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: eligottlieb at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 8999
  --> http://llvm.org/bugs/attachment.cgi?id=8999
Core dump from the crash caused by the bug

I pass a valid LLVMModule* and a valid char* into LLVMWriteBitcodeToFile(), but
something inside LLVM::Triple::Triple() calls std::basic_string::basic_string,
which segfaults.

I've checked what happens if I vary the path fed into the function.  If I pass
an invalid path or one to which I don't have write permissions,
LLVMWriteBitcodeToFile() returns a failure code properly.  When it receives a
path it *can* open with write permissions, it creates/opens the named file to
dump bitcode, and then segfaults as described before actually writing anything.
 The file then sits empty.

Like I said, I've checked the validity of my inputs insofar as I can.  I'm
using code that worked previously to my upgrading it to LLVM 3.1 release, which
is how I feel secure in claiming my inputs are not the problem (also, I've been
printing them out to stderr, and they're normal).

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list